This is a skeleton of microservices development based on spring using kafka/zookeeper for event driven architecture. Code provides;
‘DataSource, MyDataProcessor, DataSink’
together with events pipeline built as docker containers
In order to test this application in a docker environment; you must have docker and docker-compose installed.
Monitoring of Kafka queues is done through Grafana therefore, Kafka needs to be started with JMX exporter from prometheus. Prometheus/Grafana are integrated with application for performance and kafka queues monitoring.
Building for Production with Docker
Since Kafka/Zookeeper are required for publisher/subscriber messaging system, a docker file is provided that already contains kafka, zookeeper, prometheus, graphana and graf_db images. To fully dockerize this application and all the services that it depends on, build with production profile with docker support as below;
Download repository and execute following in root directory ./mvnw package -Pprod docker:build
Initialize Docker Containers
To initialize docker container run below command from root directory:
docker-compose -f src/main/docker/app.yml up
To stop it and remove the container, run:
docker-compose -f src/main/docker/app.yml down
Kafka mertics exposed through JMX is visible here;
Grafana Dashboard is accessible here
In some instances, you will notice failure while building because following environment variables need settings;