Closed cmhteixeira closed 4 years ago
Thanks for getting in touch but this question doesn't belong here. Please use StackOverflow and If you believe there is an issue or something missing please report it in https://github.com/spring-projects/spring-framework/issues.
It's not clear why you can't extend DelegatingWebSocketMessageBrokerConfiguration
and override simpleBrokerMessageHandler()
, and of course also remove @EnableWebSocketMessageBroker
and declare your own DelegatingWebSocketMessageBrokerConfiguration
as a bean.
Is it necessary to fork
AbstractMessageBrokerConfiguration
to implement our own customSubscriptionRegistry
, or is there a less intrusive alternative ?I am in a situation where I need to have a more personalised
SubscriptionRegistry
. In particular, I need for the rest of my application to know when a user subscribes to a certain destination. Currently, I am using the ApplicationContext events (e.gSessionSubscribeEvent
,SessionUnsubscribeEvent
, ...) to inform me of that. This has grown into a scenario in which I am basically managing subscriptions for sessions in parallel with theDefaultSubscriptionRegistry
. This could be overcome if only I could make a rather contained change to theDefaultSubscriptionRegistry
[inject an observable there].Sofar, I am have not been able to do that. I believe my problem is that method
getBrokerRegistry()
on classAbstractMessageBrokerConfiguration
is final. If it weren't, I reckon I could overwrite it to return a customMessageBrokerRegistry
. This customMessageBrokerRegistry
would just overwrite methodenableSimpleBroker
. Eventually, I would be able to get hold of theSimpleBrokerMessageHandler
and call its methodpublic setSubscriptionRegistry(SubscriptionRegistry myCustomSubscriptionRegistry)
.I am contemplating simply forking
AbstractMessageBrokerConfiguration
, copying all its content , but removing the final keyword. Is there any better way to achieve this?Relevant similar issues : /spring-projects/spring-framework#16645, #36