Skip to content

surendragalwa11/spring-cloud-stream-kafka-consumer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

spring-cloud-stream-kafka-consumer

Sample Spring Cloud Stream Kafka Consumer

How to start

Run following commands & Run Consumer without group id

mvn clean install
mvn spring-boot:run -Dspring.cloud.stream.kafka.binder.brokers=<KAFKA_BROKER_URL> -Dspring.cloud.stream.bindings.input.destination=<TOPIC_NAME>

Steps to reproduce kafka-binder-issue:

  1. Once the application starts, send some messages on the kafka topic you provided.
  2. Stop the application & send some more messages on the kafka topic.
  3. Run the application again by providing a fresh consumer group id and consumer startOffset (value latest).
  4. Notice that it does not listen to the messages which were sent between the stop (consumer without group id) & start (consumer with new group id) phase.

Docker Setup

  1. Run the below command to build the docker image
mvn clean install
docker build . -t consumer
  1. Run the src/main/docker/docker-compose-consumer.yml file with the following command
docker-compose -f docker-compose-consumer.yml up
  1. Send some messages on the kafka topic you provided.
  2. Stop the application & send some more messages on the kafka topic.
  3. Run the application again by uncommenting last 2 lines of the docker-compose file's environment section. (group id & startOffset).
  4. Notice that it does not listen to the messages which were sent between the stop (consumer without group id) & start (consumer with new group id) phase.

About

Sample Spring Cloud Stream Kafka Consumer

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published