Java Code Examples for org.springframework.messaging.simp.config.MessageBrokerRegistry#enableSimpleBroker()

The following examples show how to use org.springframework.messaging.simp.config.MessageBrokerRegistry#enableSimpleBroker() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: WebSocketConfig.java    From demo-projects with MIT License 7 votes vote down vote up
@Override
public void configureMessageBroker(MessageBrokerRegistry registry) {
    /*
     * This enables a simple (in-memory) message broker for our application.
     * The `/topic` designates that any destination prefixed with `/topic`
     * will be routed back to the client.
     * It's important to keep in mind, this will not work with more than one
     * application instance, and it does not support all of the features a
     * full message broker like RabbitMQ, ActiveMQ, etc... provide.
     */
    registry.enableSimpleBroker("/topic");
    /*
     * The application destination prefix `/app` designates the broker to send
     * messages prefixed with `/app` to our `@MessageMapping`s.
     */
    registry.setApplicationDestinationPrefixes("/app");
}
 
Example 2
Source File: WebSocketConfig.java    From youran with Apache License 2.0 5 votes vote down vote up
@Override
public void configureMessageBroker(MessageBrokerRegistry config) {
    // 启用内置简单broker,可订阅路径前缀为/code_gen
    // 浏览器连接websocket以后,就能订阅 /code_gen/* 主题了
    config.enableSimpleBroker("/code_gen");
    // 配置stomp协议的消息接收路径前缀
    // 浏览器连接websocket以后,就能给 /code_gen/* 发送消息
    config.setApplicationDestinationPrefixes("/code_gen");
}
 
Example 3
Source File: WebSocketConfig.java    From WebSocketExample with MIT License 5 votes vote down vote up
/**
 * Configure message broker
 * <p>
 * 配置使用消息代理
 *
 * @param registry message broker registry
 */
@Override
public void configureMessageBroker(MessageBrokerRegistry registry) {
    // Configure global message broker, client will subscribe these message brokers to receive messages
    // 统一配置消息代理,消息代理即订阅点,客户端通过订阅消息代理点接受消息
    registry.enableSimpleBroker("/b", "/g", "/user");

    // configure point to point message's prefix
    // 配置点对点消息的前缀
    registry.setUserDestinationPrefix("/user");
}
 
Example 4
Source File: WebSocketConfig.java    From spring-websocket-template with MIT License 5 votes vote down vote up
@Override
public void configureMessageBroker(MessageBrokerRegistry brokerRegistry) {
    /*
     * The application destination prefix is an arbitrary prefix to
     * differentiate between messages that need to be routed to
     * message-handling methods for application level work vs messages to be
     * routed to the broker to broadcast to subscribed clients. After
     * application level work is finished the message can be routed to
     * broker for broadcasting.
     */
    brokerRegistry.setApplicationDestinationPrefixes("/app");

    /*
     * The list of destination prefixes provided in this are based on what
     * broker is getting used. In this case we will use in-memory broker
     * which doesn't have any such requirements. For the purpose of
     * maintaining convention the "/topic" and the "/queue" prefixes are
     * chosen. The convention dictates usage of "/topic" destination for
     * pub-sub model targeting many subscribers and the "/queue" destination
     * for point to point messaging.
     */
    brokerRegistry.enableSimpleBroker("/topic", "/queue");

    /*
     * For configuring dedicated broker use the below code.
     */
    // brokerRegistry.enableStompBrokerRelay("/topic", "/queue");
}
 
Example 5
Source File: WebSocketStompClientIntegrationTests.java    From java-technology-stack with MIT License 4 votes vote down vote up
@Override
public void configureMessageBroker(MessageBrokerRegistry configurer) {
	configurer.setApplicationDestinationPrefixes("/app");
	configurer.enableSimpleBroker("/topic", "/queue");
}
 
Example 6
Source File: WebSocketConfig.java    From spring-session with Apache License 2.0 4 votes vote down vote up
@Override
public void configureMessageBroker(MessageBrokerRegistry registry) {
	registry.enableSimpleBroker("/queue/", "/topic/");
	registry.setApplicationDestinationPrefixes("/app");
}
 
Example 7
Source File: MultipleTaskExecutorsIT.java    From camunda-bpm-platform with Apache License 2.0 4 votes vote down vote up
@Override
public void configureMessageBroker(MessageBrokerRegistry config) {
  config.enableSimpleBroker("/topic", "/queue", "/user");
  config.setApplicationDestinationPrefixes("/app");
}
 
Example 8
Source File: WebsocketConfiguration.java    From ServiceCutter with Apache License 2.0 4 votes vote down vote up
@Override
public void configureMessageBroker(final MessageBrokerRegistry config) {
	config.enableSimpleBroker("/topic");
}
 
Example 9
Source File: WebSocketStompConfig.java    From Project with Apache License 2.0 4 votes vote down vote up
@Override
	public void configureMessageBroker(MessageBrokerRegistry registry) {
//    registry.enableStompBrokerRelay("/queue", "/topic");
		registry.enableSimpleBroker("/queue", "/topic");
		registry.setApplicationDestinationPrefixes("/app");
	}
 
Example 10
Source File: StompWebSocketIntegrationTests.java    From spring4-understanding with Apache License 2.0 4 votes vote down vote up
@Override
public void configureMessageBroker(MessageBrokerRegistry configurer) {
	configurer.setApplicationDestinationPrefixes("/app");
	configurer.enableSimpleBroker("/topic", "/queue");
}
 
Example 11
Source File: WebSocketConfig.java    From spring-websocket-android-client-demo with MIT License 4 votes vote down vote up
@Override
public void configureMessageBroker(MessageBrokerRegistry config) {
   config.enableSimpleBroker("/topics");
   config.setApplicationDestinationPrefixes("/app");
}
 
Example 12
Source File: WebSocketConfig.java    From ddd-with-spring with Apache License 2.0 4 votes vote down vote up
@Override
public void configureMessageBroker(MessageBrokerRegistry config) {
	config.enableSimpleBroker("/topic");
	config.setApplicationDestinationPrefixes("/app");
}
 
Example 13
Source File: WebSocketConfig.java    From flow-platform-x with Apache License 2.0 4 votes vote down vote up
@Override
public void configureMessageBroker(MessageBrokerRegistry registry) {
    registry.enableSimpleBroker("/topic");
    registry.setApplicationDestinationPrefixes("/app");
}
 
Example 14
Source File: WebSocketConfig.java    From iot-traffic-monitor with Apache License 2.0 4 votes vote down vote up
@Override
public void configureMessageBroker(MessageBrokerRegistry config) {
    config.enableSimpleBroker("/topic");
}
 
Example 15
Source File: WsConfig.java    From spring-examples with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void configureMessageBroker(MessageBrokerRegistry registry) {
    registry.enableSimpleBroker("/topic");
}
 
Example 16
Source File: WebSocketConfig.java    From Demo with Apache License 2.0 4 votes vote down vote up
@Override
public void configureMessageBroker(MessageBrokerRegistry registry) {
    // 广播式配置名为 /nasus 消息代理 , 这个消息代理必须和 controller 中的 @SendTo 配置的地址前缀一样或者全匹配
    // 点对点增加一个 /queue 消息代理
    registry.enableSimpleBroker("/queue","/nasus/getResponse");
}
 
Example 17
Source File: WebSocketConfig.java    From springboot-sockjs-stomp-vue-sample with MIT License 4 votes vote down vote up
@Override
public void configureMessageBroker(MessageBrokerRegistry config) {
    config.enableSimpleBroker("/stock");
    config.setApplicationDestinationPrefixes("/app");
}
 
Example 18
Source File: WebSocketConfig.java    From citrus-admin with Apache License 2.0 4 votes vote down vote up
@Override
public void configureMessageBroker(MessageBrokerRegistry config) {
    config.enableSimpleBroker("/topic");
    config.setApplicationDestinationPrefixes("/api/socket");
}
 
Example 19
Source File: WebSocketConfig.java    From myfeed with Apache License 2.0 4 votes vote down vote up
@Override
public void configureMessageBroker(MessageBrokerRegistry config) {
	config.enableSimpleBroker("/topic");
	config.setApplicationDestinationPrefixes("/app");
}
 
Example 20
Source File: WebSocketStompClientIntegrationTests.java    From spring-analysis-note with MIT License 4 votes vote down vote up
@Override
public void configureMessageBroker(MessageBrokerRegistry configurer) {
	configurer.setApplicationDestinationPrefixes("/app");
	configurer.enableSimpleBroker("/topic", "/queue");
}