-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Add an event to RedisContainer when subscription is ready [DATAREDIS-1047] #1622
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
Comments
Mark Paluch commented We could likely provide such a feature by using Redis subscription notifications. It would make sense to allow Care to elaborate a bit on your use-case? Are you just interested in awaiting the container startup or do you want to await if a particular subscription is activated? |
Piotr commented This is our use case:
The problem here is that there is a race condition if the events occur in the following order:
In lettuce there is way to react when the subscription is ready. In our case we could use this event to send "initial state" to client. In other words, we need to know when the redis subscription is ready so we can send initial state |
Mark Paluch commented Thanks a lot for the background details. So both enhancements, awaiting the container startup (delay application context startup) as well as awaiting that a single subscription gets active make sense. We would introduce two changes:
|
Piotr commented Great, it makes sense. Any of these changes would resolve our problem |
Depends on #1697 |
Depends on #2054 |
This will be fixed via #964. |
Piotr opened DATAREDIS-1047 and commented
Currently addMessageListener is asynchronous method and there is no way to determine if a subscription is ready (it uses lazy loading). In my scenario I need to know when a service is ready to receive messages from Redis as it needs to send initial state to connected clients.
The feature would be also useful for scenarios when subscriptions are added at runtime rather than at startup.
The similar problem was reported here: https://stackoverflow.com/questions/32297321/spring-data-redis-how-do-i-know-that-messagelistener-is-ready
No further details from DATAREDIS-1047
The text was updated successfully, but these errors were encountered: