-
producer
Spring BootWeb Java application that creates message and pushes topic inKafka. -
consumer
Spring BootWeb Java application that consumes message from topic inKafka.
-
Open a terminal and inside
kafkaroot folder rundocker-compose up -d -
Wait a until all containers are Up (healthy). You can check their status by running
docker-compose ps
Inside kafka root folder, run the following Gradle commands in different terminals
-
eureka-server
./gradlew :eureka-server:clean build -
producer
./gradlew :producer:clean build -
consumer
./gradlew :consumer:clean build
-
In a terminal, make sure you are in
kafkaroot folder -
In order to build the applications docker images, run the following script
./build-apps.sh
-
producer
Environment Variable Description KAFKA_HOSTSpecify host of the
Kafkamessage broker to use (defaultlocalhost)KAFKA_PORTSpecify port of the
Kafkamessage broker to use (default29092)EUREKA_HOSTSpecify host of the
Eurekaservice discovery to use (defaultlocalhost)EUREKA_PORTSpecify port of the
Eurekaservice discovery to use (default8761)ZIPKIN_HOSTSpecify host of the
Zipkindistributed tracing system to use (defaultlocalhost)ZIPKIN_PORTSpecify port of the
Zipkindistributed tracing system to use (default9411) -
consumer
Environment Variable Description KAFKA_HOSTSpecify host of the
Kafkamessage broker to use (defaultlocalhost)KAFKA_PORTSpecify port of the
Kafkamessage broker to use (default29092)EUREKA_HOSTSpecify host of the
Eurekaservice discovery to use (defaultlocalhost)EUREKA_PORTSpecify port of the
Eurekaservice discovery to use (default8761)ZIPKIN_HOSTSpecify host of the
Zipkindistributed tracing system to use (defaultlocalhost)ZIPKIN_PORTSpecify port of the
Zipkindistributed tracing system to use (default9411)
| Application | URL |
|---|---|
producer |
-
Stop applications
-
If they were started with
Gradle, go to the terminals where they are running and pressCtrl+C -
If they were started as a Docker container, run the script below
./stop-apps.sh
-
-
Stop and remove docker-compose containers, networks and volumes
docker-compose down -v
-
Eureka
Eurekacan be accessed at http://localhost:8761 -
Kafka Topics UI
Kafka Topics UIcan be accessed at http://localhost:8085 -
Zipkin
Zipkincan be accessed at http://localhost:9411The figure below shows an example of the complete flow a request passes through. It goes since
producer-api, where the message is created, untilconsumer-api. -
Kafka Manager
Kafka Managercan be accessed at http://localhost:9000Configuration
-
First, you must create a new cluster. Click on
Cluster(dropdown button on the header) and then onAdd Cluster -
Type the name of your cluster in
Cluster Namefield, for example:MyZooCluster -
Type
zookeeper:2181inCluster Zookeeper Hostsfield -
Enable checkbox
Poll consumer information (Not recommended for large # of consumers if ZK is used for offsets tracking on older Kafka versions) -
Click on
Savebutton at the bottom of the page.
-
