Skip to content

9. StockService Microservice Configure Kafka Consumer.md

Ramesh Fadatare edited this page Jul 11, 2022 · 1 revision

application.properties

server.port=8081
spring.kafka.consumer.bootstrap-servers: localhost:9092
spring.kafka.consumer.group-id: stock
spring.kafka.consumer.auto-offset-reset: earliest
spring.kafka.consumer.key-deserializer: org.apache.kafka.common.serialization.StringDeserializer
spring.kafka.consumer.value-deserializer: org.springframework.kafka.support.serializer.JsonDeserializer
spring.kafka.consumer.properties.spring.json.trusted.packages=*

spring.kafka.topic.name=order_topics

Make sure to add different group names for different microservices

For stock-service, group name - stock For email-service, group name - email

stock-service and email-service consume messages from the same topic - order_topics