Search code examples
javacachingapache-kafkaspring-kafkain-memory

Update static map in memory based on kafka event?


My application is deployed on multiple nodes and more nodes can be added dynamically. I have a static java map to store some configs by ID. I receive an event on kafka topic whenever those configs are added/updated/deleted. I have one consumer group and I need to update this static map on all the nodes.

For reference, I prefer to not use any other DB for this - distributed/in-memory, etc,.

Kindly suggest the best approach to do this - with or without using DB.


Solution

  • You need to use a different group.id on each node; only one consumer is a group can consume from a single partition.