Marcus Held opened SPR-17107 and commented
I'd like to have more information of the subscription in the SessionUnsubscribeEvent to react on specific subscriptions.
Currently I can only investigate the Unsubscribe Message in the SessionUnsubscribeEvent and in there I can see the subscribe id. But with this subscribe id I might can not work at this point in time because the corresponding subscription might not be in the user registry anymore at this point. Therefore I'd like to have the information of the subscription in the SessionUnsubscribeEvent itself (in particular, I'm interested in the subscribe destination)
No further details from SPR-17107
Comment From: spring-projects-issues
Rossen Stoyanchev commented
This information is not available in StompSubProtocolHandler, and we could get it from the SimpUserRegistry, but there is some overhead in looking this up, where the event might not even be checked by anything.
I am wondering if you have considered installing a ChannelInterceptor on the "clientInboundChannel"? That would be invoked before the message is sent and before the event is sent, and so before the SimpUserRegistry has seen it.
Comment From: spring-projects-issues
Marcus Held commented
Thanks for your fast reply.
Your suggestion is working in practice, but the order seems wrong, because I want to react when an unsubscribe happened and not before that and suppose that it will work without an exception.
Comment From: spring-projects-issues
Rossen Stoyanchev commented
Channelintercector#afterReceiveCompletion
is invoked after the message is sent, it tells you whether the send failed or not, and it happens just before the unsubscribe event is sent.
Comment From: spring-projects-issues
Marcus Held commented
Thank you for the hint. It wasn't clear to me that this is invoked before the event. That request might be resolved with that then.
Comment From: spring-projects-issues
Rossen Stoyanchev commented
Alright resolving then. You can take a look in StompSubProtocolHandle to see where it calls send on the channel (which includes interceptors) and then, if successful, sends the events.
Comment From: weejinyoung
good