-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
StreamMessageListenerContainer
stops consuming messages after connection timeout to Redis
#2833
Comments
Thank you for getting in touch. Which Redis driver are you using? 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. |
seems like the spring-data-redis auto unsubscribe when exception. spring-data-redis/src/main/java/org/springframework/data/redis/stream/StreamPollTask.java Lines 136 to 138 in a7d3914
the value of Line 337 in a7d3914
when the Subscription subscription =
listenerContainer.register(
StreamMessageListenerContainer.StreamReadRequest
.builder(StreamOffset
.create(REDIS_STREAM_KEY_REFRESH_RELATION, ReadOffset.lastConsumed()))
// here
.cancelOnError(t -> false)
.consumer(Consumer.from(REDIS_STREAM_KEY_REFRESH_RELATION_GROUP_NAME,
REDIS_STREAM_KEY_REFRESH_RELATION_CONSUMER_NAME))
.autoAcknowledge(true).build(),
streamListener); by the way ,i think the default value of |
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
StreamMessageListenerContainer
).The text was updated successfully, but these errors were encountered: