Skip to content
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

SimpleBrokerMessageHandler SubscriptionRegistry DestinationCache doesn't honour unique subscriptionId [SPR-15414] #19976

Closed
spring-projects-issues opened this issue Apr 5, 2017 · 2 comments
Assignees
Labels
in: messaging Issues in messaging modules (jms, messaging) in: web Issues in web modules (web, webmvc, webflux, websocket) status: duplicate A duplicate of another issue

Comments

@spring-projects-issues
Copy link
Collaborator

spring-projects-issues commented Apr 5, 2017

Stephen Morrison opened SPR-15414 and commented

Hi folks,
When creating a subscription to a destination/topic in Spring WebSockets & STOMP I'm seeing a discrepancy in how the SessionSubscriptionRegistry and DestinationCache (within DefaultSubscriptionRegistry.addSubscriptionInternal) stores the subscription when there are multiple subscriptions (with the same subscriptionId) to the same destination for the same session.

The SessionSubscriptionRegistry.addSubscription stores the subscriptions into a Set therefore not allowing duplicate subscriptions with same subscriptionId to be stored for each session. This is desired functionality as I would prefer the client can subscribe to a destination multiple times and not have to worry about subscribing and unsubscribing before re-subscribing to the same destination. My use case is a chat window modal window.

However the DestinationCache.updateAfterNewSubscription stores the subscriptions into a Map of LinkedMultiValueMap keyed off the destination then the sessionId. Therefore we get a bunch of entries with the same sessionId/subId pairing in the LinkedMultiValueMap. I think this is a bug as the SessionSubscriptionRegistry and DestinationCache should contain the same number of unique subscriptions per session and destination.

The result of this issue is we see multiple messages sent via SimpleBrokerMessageHandler.sendMessageToSubscribers as this looks into the cache which contains a bunch of duplicate subscriptionIds.

On another note is there any way I could customise the SubscriptionRegistry or the DestinationCache for the SimpleBrokerMessageHandler so I may provide my own implementation of these classes?

Thanks,
Stephen


Affects: 4.3.7

Issue Links:

@spring-projects-issues
Copy link
Collaborator Author

Stephen Morrison commented

Removing what I thought was a workaround from description.

@spring-projects-issues
Copy link
Collaborator Author

spring-projects-issues commented May 19, 2017

Rossen Stoyanchev commented

This should be resolved now with #20102.

@spring-projects-issues spring-projects-issues added type: bug A general bug in: messaging Issues in messaging modules (jms, messaging) status: duplicate A duplicate of another issue in: web Issues in web modules (web, webmvc, webflux, websocket) labels Jan 11, 2019
@spring-projects-issues spring-projects-issues removed the type: bug A general bug label Jan 12, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: messaging Issues in messaging modules (jms, messaging) in: web Issues in web modules (web, webmvc, webflux, websocket) status: duplicate A duplicate of another issue
Projects
None yet
Development

No branches or pull requests

2 participants