`StreamMessageListenerContainer` stops consuming messages after connection timeout to Redis
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
- Create a message listener using this guide (with a
StreamMessageListenerContainer). - Publish an event (to make sure the message is successfully received).
- Restart the Redis instance (to simulate a connection timeout)
- Publish an event (should not be received)
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.
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.