-
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
RedisMessageListenerContainer
messages are received twice
#3111
Comments
What you see seems correct to me. You're subscribing and registering listeners twice for the same notification at the same time. Both web requests run at the same time and do not enforce any kind of synchronization. What you actually want to achieve is to ensure a single listener notification, a second request should rather attach to the stream and the last terminating request should close the listener registration. |
If you would like us to look at this issue, please provide the requested information. If the information is not provided within the next 7 days this issue will be closed. |
Yes, that's what I want to achieve. Comment on ListenerContainer suggests it will handle concurrent operations, but in this case, it won't. |
means that you do not need to enforce synchronization when calling Closing this ticket as things work as designed and documented. |
Issue
I’m developing a Spring-based web application in Kotlin that pushes messages from Redis Pub/Sub to active SSE (Server-Sent Events) connections. However, while running integration tests, I discovered that messages are being processed twice.
My code
Config
Controller
Subscription Manager
Connection pool
Notification listener
Integration test:
Console output:
Workaround
When I modify the bean configuration to add a dummy listener at startup and initialize message listening eagerly, the issue is resolved.
Console output:
The text was updated successfully, but these errors were encountered: