Spring Websocket with Stomp full featured broker and failover
<p>I have those configuration for spring and a full feature stomp broker (ActiveMQ):</p>
<pre class="lang-java prettyprint-override"><code>@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(&quot;/topic/&quot;, &quot;/queue/&quot;);
        config.setApplicationDestinationPrefixes(&quot;/app&quot;);
        config.setUserDestinationPrefix(&quot;/user&quot;);
    }

    @Override
    public void registerStompEndpoints(StompEndpointRegistry registry) {
        registry.addEndpoint(&quot;/socket&quot;).withSockJS();
    }
}
</code></pre>
<p>Naively, I though spring used my current ActiveMQ configuration but in reality it tries to connect into a server located in localhost with a default stomp port. I discovered that is possible to change this configuration by typing:</p>
<pre><code>config.enableStompBrokerRelay(&quot;/topic/&quot;, &quot;/queue/&quot;)
            .setRelayHost(&quot;activeMQHOST&quot;)
            .setRelayPort(9999);
</code></pre>
<p>Thats fine, but currently I have a failover setup with two brokers (<a href="http://activemq.apache.org/shared-file-system-master-slave.html" rel="nofollow noreferrer">master/flave with shared file system</a>). <strong>How can I configure such setup for the stomp broker relay?</strong></p>
<p>If not possible, I thought in the following solutions:</p>
<ol>
<li>Use the simple (in memory) broker, which doesn't advisable</li>
<li>The ActiveMQ is used for several operations (not restricted to websockets) and I don't know if it is recommended to mix stomp/websockets queues with other feature's queues. Thinking on it, I can create <em>another</em> ActiveMQ instance (maybe using the <a href="http://activemq.apache.org/vm-transport-reference.html" rel="nofollow noreferrer">VM transport</a>.</li>
</ol>
<p>The second option is advisable?</p>