-
Notifications
You must be signed in to change notification settings - Fork 38.3k
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
Exclude User Destination Messages in Broker Message Handler #26474
Comments
Can you share the destinations to which the message broker is configured to process? The problem in #26118 is not that there are duplicate subscriptions, but that the user destinations are processed by both the broker and the user destination handler. That was explained in my last #26118 (comment) there. |
You mean something like We currently only use /user based unidirectional push messages through the aforementioned SimpMessagingTemplate, no client-initiated messages. Is there something we need to change using v5.3.3 regarding the WebSocket configuration? I'm still confused about the inconsistent /user destinations in the DestinationCache at runtime (parameterized with {username}, registered without). |
So that means it's processing all destinations. This is essentially the same issue. |
Once again |
Shouldn't the broker configuration handle Maybe I have some kind of misunderstanding.. I'm not sure what the configuration should look like than. Do I need to specify every destination following after |
Btw, thanks for your last explanation about the separate user message handler. That explains the unexpected |
There is a common convention in message brokers to use That said I can see a potential improvement. When a user destination prefix is configured, then the broker message handler should exclude such messages from its processing. |
Affects: v5.3.3
We used WebSockets within Spring Boot 2.3.5 (Spring Framework 5.2.10). After updating to Spring Boot 2.4.2 (Spring Framework 5.3.3), we noticed that our WebSocket mechanism was no longer working.
We looked at #26118, but the discussion there was about duplicate subscriptions and wrongly registered /user destinations. In our case we have only a single subscription per sessionId/subscriptionId.
WebSocket is basically configured like this:
In our application we use user-specific WebSocket messages as a push mechanism. The client subscribes to /user/events, the server sends messages to /user/{username}/events using SimpMessagingTemplate#convertAndSendToUser. This worked as expected up to Version 5.3.3.
After a little bit of debugging, we've noticed that there might now be a problem with user-specific subscriptions due to a change with #24395. DestinationCache#calculateSubscriptions now operates on an exact destination equals-comparison when using non-pattern-based subscriptions.
While debugging the issue you can see, that the active subscription to
subscriptionDetail.getDestination()="/user/events"
is compared to a givendestination="/user/{username}/events"
, which has been extracted from the new user-specific Message in AbstractSubscriptionRegistry#findSubscriptions called by SimpleBrokerMessageHandler#sendMessageToSubscribers.To me it looks like the {username} part of the message destination is not properly handled here.
The text was updated successfully, but these errors were encountered: