I have this configuration for spring and a fully functional stomp broker (activemq):
@Configuration @EnableWebSocketMessageBroker public class WebsocketConfig extends AbstractWebSocketMessageBrokerConfigurer { private static Logger LOG = org.slf4j.LoggerFactory.getLogger(WebsocketConfig.class); @Override public void configureMessageBroker(MessageBrokerRegistry config) { config.enableStompBrokerRelay("/topic/", "/queue/"); config.setApplicationDestinationPrefixes("/app"); config.setUserDestinationPrefix("/user"); } @Override public void registerStompEndpoints(StompEndpointRegistry registry) { registry.addEndpoint("/socket").withSockJS(); } }
Naively, although spring used my current activemq configuration, it actually tries to connect to a server located on the local host with the default stomp port. I found that you can change this configuration by typing:
config.enableStompBrokerRelay("/topic/", "/queue/") .setRelayHost("activeMQHOST") .setRelayPort(9999);
Ok, but currently I have a switch setup with two brokers ( master / flave with a common file system ). How to configure this setting for stomp repeater?
If this is not possible, I thought of the following solutions:
- Use a simple (in mind) broker that is not recommended
- ActiveMQ is used for several operations (not limited to web windows), and I don't know if it is recommended to mix stomp / websockets queues with other function queues. Thinking about this, I can create another instance of activeMQ (possibly using VM transport .
The second option is recommended?
source share