我有spring的配置和一个完整的功能stomp代理(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();
}
}
天真地,我虽然spring使用了我当前的activemq配置,但实际上它尝试使用默认的stomp端口连接到localhost中的服务器 . 我发现可以通过输入以下内容来更改此配置:
config.enableStompBrokerRelay("/topic/", "/queue/")
.setRelayHost("activeMQHOST")
.setRelayPort(9999);
多数民众赞成,但目前我有两个经纪人的故障转移设置(master/flave with shared file system) . How can I configure such setup for the stomp broker relay?
如果不可能,我想在以下解决方案中:
-
使用简单(内存中)代理,这是不可取的
-
ActiveMQ用于多个操作(不限于websockets),我不知道是否建议将stomp / websockets队列与其他功能的队列混合使用 . 考虑一下,我可以创建另一个activeMQ实例(可能使用VM transport .
第二种选择是可取的吗?