Affects: v.5.3.2 Worked in version: 5.3.1

In the latest point release the method subProtocolWebSocketHandler in class WebSocketMessageBrokerConfigurationSupport was quietly changed in an incompatible version so my app does not compile any more.

The old code was

public WebSocketHandler subProtocolWebSocketHandler()

while the new one is

public WebSocketHandler subProtocolWebSocketHandler(AbstractSubscribableChannel clientInboundChannel,
                                                    AbstractSubscribableChannel clientOutboundChannel)

At the same time the clientInboundChannel and clientOutboundChannel do not exist any more so it's not trivial (for my usecase) to change the code to the new release.

I think you should do this kind of source and binary incompatibility only on major releases and not in minor releases, at least without a clear documentation about it explaining why it has been done and how to migrate user code.

Comment From: sdeleuze

Hi, indeed those changes were actually leftovers that we missed for 5.3.0 and that were introduced in 5.3.2 in order to enable native compatibility, sorry for those late changes in a patch release. They are mentioned in the upgrade notes but I am open to provide mode guidance.

As of Spring Framework 5.3.2, clientInboundChannel and clientOutboundChannel parameters will be injected automatically so you do not need invoking clientOutboundChannel() or clientOutboundChannel(), just using those parameters.

Could you please provide more details about your use case in order to allow me to help you and eventually refine the documentation?

Comment From: Polve

He Stephan and thanks for your reply.

My config class is of this kind:

@Configuration
@EnableWebSocketMessageBroker
public class StompWebSocketConfig extends WebSocketMessageBrokerConfigurationSupport implements WebSocketMessageBrokerConfigurer {
...
@Bean
@Override
public WebSocketHandler subProtocolWebSocketHandler() {
  return new CustomSubProtocolWebSocketHandler(clientInboundChannel(), clientOutboundChannel(), myService);
}

This code does not compile anymore and it's not clear to me how should I refactor the code: I checked the release notes but I'm unable to get any useful clue from it.

Any help would be very appreciated.

Comment From: sdeleuze

Hi,

Could you please try something like this and let me know if that fits with your use case?

@Configuration
@EnableWebSocketMessageBroker
public class StompWebSocketConfig extends WebSocketMessageBrokerConfigurationSupport implements WebSocketMessageBrokerConfigurer {
...
@Bean
@Override
public WebSocketHandler subProtocolWebSocketHandler(AbstractSubscribableChannel clientInboundChannel, AbstractSubscribableChannel clientOutboundChannel) {
  return new CustomSubProtocolWebSocketHandler(clientInboundChannel, clientOutboundChannel, myService);
}
}

PS I am Sébastien not Stephan ;-)

Comment From: rstoyanchev

Also note that use of @EnableWebSocketMessageBroker which imports the configuration from WebSocketMessageBrokerConfigurationSupport is meant to be mutually exclusive with declaring your own extension of WebSocketMessageBrokerConfigurationSupport for more advanced config. It looks like you can drop the @EnableWebSocketMessageBroker annotation.

Comment From: sdeleuze

@Polve Were you able to solve your migration issue based on our insights?

Comment From: Polve

I didn't complete all the test set, but for now it seems to work fine! Thanks for your insights Sébastien and Rossen