spring-data-redis icon indicating copy to clipboard operation
spring-data-redis copied to clipboard

`StreamMessageListenerContainer` stops consuming messages after connection timeout to Redis

Open radjavi opened this issue 1 year ago • 3 comments

Problem

I have been following this guide for implementing asynchronous message listeners for Redis streams. The listeners work as expected at first. However, if a temporary connection timeout occurs towards Redis (e.g. Redis becomes unavailable), the listeners stop consuming messages indefinitely (even though Redis is available).

How to reproduce

  1. Create a message listener using this guide (with a StreamMessageListenerContainer).
  2. Publish an event (to make sure the message is successfully received).
  3. Restart the Redis instance (to simulate a connection timeout)
  4. Publish an event (should not be received)

radjavi avatar Jan 16 '24 15:01 radjavi

Thank you for getting in touch. Which Redis driver are you using? Lettuce has a connection watchdog that can trigger reconnect automatically depending on the options set.

If you'd like us to spend some time investigating, please take the time to provide a complete minimal sample (something that we can unzip or git clone, build, and deploy) that reproduces the problem.

christophstrobl avatar Jan 17 '24 07:01 christophstrobl

I have tried both Lettuce and Jedis. Same issue with both. Worth mentioning is that code in other places (e.g. an event publisher) that also connects to Redis works fine after Redis becomes available again. It's only the message listeners that stop working.

I'll see if I get some time over to create an example project.

radjavi avatar Jan 17 '24 12:01 radjavi