Spring Boot application demonstrating usage of the Kafka Streams.
This repo accompanies the following series of articles on Kafka Streams:
Run integration tests with mvn clean test
The tests demonstrate streaming payments events that are filtered and transformed, and results emitted to outbound topics.
The account balances are tracked in a state store, which is exposed via REST endpoint allowing querying the current values.
Build Spring Boot application jar:
mvn clean install
Build Docker container:
docker build -t ct/kafka-streams-demo:latest .
Assumes ct
is used as the container prefix for the component tests (which is the default but can be overridden).
Run tests:
mvn test -Pcomponent
Run tests leaving containers running (for further test runs):
mvn test -Pcomponent -Dcontainers.stayup
View consumer groups:
docker exec -it ct-kafka /bin/sh /usr/bin/kafka-consumer-groups --bootstrap-server localhost:9092 --list
Inspect consumer group:
docker exec -it ct-kafka /bin/sh /usr/bin/kafka-consumer-groups --bootstrap-server localhost:9092 --describe --group kafka-streams-demo
View topics:
docker exec -it ct-kafka /bin/sh /usr/bin/kafka-topics --bootstrap-server localhost:9092 --list
Inspect topic:
docker exec -it ct-kafka /bin/sh /usr/bin/kafka-topics --bootstrap-server localhost:9092 --describe --topic payment-event
View messages on topic:
docker exec -it ct-kafka /bin/sh /usr/bin/kafka-console-consumer --bootstrap-server localhost:9092 --topic payment-event --from-beginning
Manual clean up (if left containers up):
docker rm -f $(docker ps -aq)