Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,6 @@ Test out the app by connecting to the websocket endpoints (UI will be added soon
To configure the application to connect to your Kafka edit the properties file called `kafka.properties`.
Alternatively you can provide a custom path to the properties file using `-Dproperties_path=<path>` when starting the application.

If your Kafka is secured you will need to enable the security configuration options in your properties file
If your Kafka is secured you will need to enable the security configuration options in your properties file.

To increase the logging level to debug provide a system property at start time: `-Dlog.level=debug`.
6 changes: 5 additions & 1 deletion src/main/java/kafka/vertx/demo/PeriodicProducer.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import io.vertx.core.json.JsonObject;
import io.vertx.kafka.client.producer.KafkaProducer;
import io.vertx.kafka.client.producer.KafkaProducerRecord;
import org.apache.kafka.clients.producer.ProducerConfig;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

Expand All @@ -35,9 +36,12 @@ public void start(Promise<Void> startPromise) {
}

private void setup(HashMap<String, String> props) {
// Don't retry and only wait 10 secs for partition info as this is a demo app
props.put(ProducerConfig.RETRIES_CONFIG, "0");
props.put(ProducerConfig.MAX_BLOCK_MS_CONFIG, "10000");
KafkaProducer<String, String> kafkaProducer = KafkaProducer.create(vertx, props);

kafkaProducer.exceptionHandler(err -> logger.error("Kafka error: {}", err));
kafkaProducer.exceptionHandler(err -> logger.debug("Kafka error: {}", err));

TimeoutStream timerStream = vertx.periodicStream(2000);
timerStream.handler(tick -> produceKafkaRecord(kafkaProducer, props.get(Main.TOPIC_KEY)));
Expand Down
3 changes: 2 additions & 1 deletion src/main/resources/logback.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@
<logger name="io.netty" level="warn"/>
<logger name="io.vertx" level="info"/>
<logger name="org.apache.kafka" level="error"/>
<logger name="org.apache.kafka.clients.NetworkClient" level="warn"/>

<root level="info">
<root level="${log.level:-info}">
<appender-ref ref="STDOUT"/>
</root>

Expand Down