diff --git a/README.md b/README.md index 8ff8036e..3fd63b0f 100644 --- a/README.md +++ b/README.md @@ -41,3 +41,5 @@ Alternatively you can provide a custom path to the properties file using `-Dprop 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`. + +To increase the Kafka client logging level to info provide a system property at start time: `-Dlog.level.kafka=info`. diff --git a/kafka.properties b/kafka.properties index c1f4d6e6..5905f0f4 100644 --- a/kafka.properties +++ b/kafka.properties @@ -7,7 +7,6 @@ bootstrap.servers=localhost:9092 ################################################################### group.id=my_group auto.offset.reset=earliest -enable.auto.commit=false key.deserializer=org.apache.kafka.common.serialization.StringDeserializer value.deserializer=org.apache.kafka.common.serialization.StringDeserializer diff --git a/src/main/java/kafka/vertx/demo/WebSocketServer.java b/src/main/java/kafka/vertx/demo/WebSocketServer.java index 6a2c230d..0546c312 100644 --- a/src/main/java/kafka/vertx/demo/WebSocketServer.java +++ b/src/main/java/kafka/vertx/demo/WebSocketServer.java @@ -17,6 +17,7 @@ import io.vertx.ext.web.handler.StaticHandler; import io.vertx.kafka.client.common.TopicPartition; import io.vertx.kafka.client.consumer.KafkaConsumer; +import org.apache.kafka.clients.consumer.ConsumerConfig; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -44,6 +45,8 @@ public void start(Promise startPromise) { String propertiesPath = System.getProperty(Main.PROPERTIES_PATH_ENV_NAME, Main.DEFAULT_PROPERTIES_PATH); Main.loadKafkaConfig(vertx, propertiesPath) .compose(config -> { + // Auto commit as this is a demo app + config.put(ConsumerConfig.ENABLE_AUTO_COMMIT_CONFIG, true); kafkaConfig = config.mapTo(HashMap.class); return startWebSocket(router); }) diff --git a/src/main/resources/logback.xml b/src/main/resources/logback.xml index 10f29c9e..4e33611a 100644 --- a/src/main/resources/logback.xml +++ b/src/main/resources/logback.xml @@ -8,7 +8,7 @@ - +