Quantcast
Channel: Active questions tagged redis+java - Stack Overflow
Viewing all articles
Browse latest Browse all 2204

How to get only one Redis event when running multiple services?

$
0
0

I have a java application running as a microservice that receives events for keys that expired in Redis (Redis is configured with "config set notify-keyspace-events Ex"). These events are read in the application using a MessageListener.

My problem is that when multiple versions of the application are running all instances receive the Redis notification and perform the same action. But this is not my intent, only one action must be performed. In my case, each key that expires in Redis must be logged once in the database.

Is there a way to configure Redis to send the event only to one instance of the same microservice? Or, the event sent by Redis can be read by multiple listeners of the multiple instances of the microservice and then can I imprement something smart, maybe using RabbitMq, to generate only one message that is processed only once?


Viewing all articles
Browse latest Browse all 2204

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>