Skip to content
Snippets Groups Projects
Commit 899b145f authored by Sören Henning's avatar Sören Henning
Browse files

Send HTTP sync per default

parent a6c3f3b1
No related branches found
No related tags found
No related merge requests found
Pipeline #6899 passed
...@@ -41,6 +41,8 @@ public final class ConfigurationKeys { ...@@ -41,6 +41,8 @@ public final class ConfigurationKeys {
public static final String HTTP_URL = "HTTP_URL"; public static final String HTTP_URL = "HTTP_URL";
public static final String HTTP_ASYNC = "HTTP_ASYNC";
public static final String PUBSUB_INPUT_TOPIC = "PUBSUB_INPUT_TOPIC"; public static final String PUBSUB_INPUT_TOPIC = "PUBSUB_INPUT_TOPIC";
public static final String PUBSUB_PROJECT = "PUBSUB_PROJECT"; public static final String PUBSUB_PROJECT = "PUBSUB_PROJECT";
......
...@@ -119,7 +119,10 @@ class EnvVarLoadGeneratorFactory { ...@@ -119,7 +119,10 @@ class EnvVarLoadGeneratorFactory {
Objects.requireNonNullElse( Objects.requireNonNullElse(
System.getenv(ConfigurationKeys.HTTP_URL), System.getenv(ConfigurationKeys.HTTP_URL),
LoadGenerator.HTTP_URI_DEFAULT)); LoadGenerator.HTTP_URI_DEFAULT));
recordSender = new HttpRecordSender<>(url); final boolean async = Boolean.parseBoolean(Objects.requireNonNullElse(
System.getenv(ConfigurationKeys.HTTP_ASYNC),
Boolean.toString(LoadGenerator.HTTP_ASYNC_DEFAULT)));
recordSender = new HttpRecordSender<>(url, async);
LOGGER.info("Use HTTP server as target with url '{}'.", url); LOGGER.info("Use HTTP server as target with url '{}'.", url);
} else if (target == LoadGeneratorTarget.PUBSUB) { } else if (target == LoadGeneratorTarget.PUBSUB) {
final String project = System.getenv(ConfigurationKeys.PUBSUB_PROJECT); final String project = System.getenv(ConfigurationKeys.PUBSUB_PROJECT);
......
...@@ -44,7 +44,17 @@ public class HttpRecordSender<T extends SpecificRecord> implements RecordSender< ...@@ -44,7 +44,17 @@ public class HttpRecordSender<T extends SpecificRecord> implements RecordSender<
* @param uri the {@link URI} records should be sent to * @param uri the {@link URI} records should be sent to
*/ */
public HttpRecordSender(final URI uri) { public HttpRecordSender(final URI uri) {
this(uri, true, List.of(HTTP_OK)); this(uri, false, List.of(HTTP_OK));
}
/**
* Create a new {@link HttpRecordSender}.
*
* @param uri the {@link URI} records should be sent to
* @param async whether HTTP requests should be sent asynchronous
*/
public HttpRecordSender(final URI uri, final boolean async) {
this(uri, async, List.of(HTTP_OK));
} }
/** /**
......
...@@ -17,6 +17,7 @@ public final class LoadGenerator { ...@@ -17,6 +17,7 @@ public final class LoadGenerator {
public static final LoadGeneratorTarget TARGET_DEFAULT = LoadGeneratorTarget.KAFKA; public static final LoadGeneratorTarget TARGET_DEFAULT = LoadGeneratorTarget.KAFKA;
// Target: HTTP // Target: HTTP
public static final String HTTP_URI_DEFAULT = "http://localhost:8080"; public static final String HTTP_URI_DEFAULT = "http://localhost:8080";
public static final boolean HTTP_ASYNC_DEFAULT = false;
// Target: Kafka // Target: Kafka
public static final String SCHEMA_REGISTRY_URL_DEFAULT = "http://localhost:8081"; public static final String SCHEMA_REGISTRY_URL_DEFAULT = "http://localhost:8081";
public static final String KAFKA_TOPIC_DEFAULT = "input"; // NOCS public static final String KAFKA_TOPIC_DEFAULT = "input"; // NOCS
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment