Skip to content

Two microservices, a Spring Boot Web application as Producer, a Java Command line application as Consumer and Kafka as broker.

Notifications You must be signed in to change notification settings

RSaravanaPrasad/MicroServices

Repository files navigation

Two microservices, a Spring Boot Web application as Producer:gear:, a Java Command line application as Consumer:gear: and Kafka:gear: as broker. Maven project generates executable jars for both Producer and Consumer. Both modules can be individually built. Build on parent pom also generates producer and consumer jars. Both can be run on separate command windows. Actuator is enabled for Consumer Command Line application also.

Start Zookeeper: .\bin\windows\zookeeper-server-start.bat .\config\zookeeper.properties

Start kafka: .\bin\windows\kafka-server-start.bat .\config\server.properties

Create topic "microTopic" and group "groupMicroTopic"

Run Producer: java -jar command on the jar from producer /target folder. This starts the Spring REST controller.

Run consumer: java -jar command on the jar from consumer /target folder. This starts the consumer

POST a string message using Postman Use http://127.0.0.1:8080/micro/produce/message to Post a message

The posted message gets logged in Producer console

Message logged in Consumer console :gear::gear::gear:

  • Logger Configuration

    • Log4J as dependency added to pom.xml

    • Log file path configured in application.properties for both Producer and Consumer.

    • Logger level configured in application.properties.

Log file named kafka-pub.log will be created in folder as configured in application.properties

Log file named kafka-sub.log will be created in folder as configured in application.properties

About

Two microservices, a Spring Boot Web application as Producer, a Java Command line application as Consumer and Kafka as broker.

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published