我有一个spring boot应用程序,它接收来自客户端的websocket主题订阅,这些订阅将被路由到我的嵌入式activemq代理.
我的代码启动我的嵌入式activemq代理
@SpringBootApplication
public class RttApplication {
public static void main(String[] args) throws Exception {
ConfigurableApplicationContext ctx = SpringApplication.run(RttApplication.class, args);
BrokerService brokerService = new BrokerService();
brokerService.setPersistent(false);
brokerService.setUseJmx(false);
brokerService.addConnector("vm://localhost:0");
brokerService.setBrokerName("event");
brokerService.start();
}
}
Run Code Online (Sandbox Code Playgroud)
我的spring broker relay配置类
@Configuration
@EnableWebSocketMessageBroker
public class MessageBrokerConfigurer extends AbstractWebSocketMessageBrokerConfigurer {
@Override
public void registerStompEndpoints(StompEndpointRegistry registry) {
registry.addEndpoint("/event").withSockJS();
}
@Override
public void configureMessageBroker(MessageBrokerRegistry registry) {
registry.enableStompBrokerRelay("/topic").setRelayHost("vm://localhost").setRelayPort(0);
registry.setApplicationDestinationPrefixes("/app");
}
}
Run Code Online (Sandbox Code Playgroud)
但是当我启动应用程序时它会显示出来
2016-02-25 15:44:34.678 INFO 7604 --- [main] oaactivemq.broker.TransportConnector:Connector vm:// localhost:0 Started
2016-02-25 15:44:34.694 INFO 7604 --- [main] o.apache.activemq.broker.BrokerService:Apache …