org.springframework.messaging.simp.config.MessageBrokerRegistry Java Examples

The following examples show how to use org.springframework.messaging.simp.config.MessageBrokerRegistry. 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 code with Apache License 2.0 7 votes vote down vote up
@Override
public void configureMessageBroker(MessageBrokerRegistry registry) {
    registry.setApplicationDestinationPrefixes("/app");

    // Enables a simple in-memory broker
    registry.enableSimpleBroker("/topic");


    //   Use this for enabling a Full featured broker like RabbitMQ
    /*
    registry.enableStompBrokerRelay("/topic")
            .setRelayHost("localhost")
            .setRelayPort(61613)
            .setClientLogin("guest")
            .setClientPasscode("guest");
    */
}
 
Example #2
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 #3
Source File: WebSocketConfig.java    From metasfresh-webui-api-legacy with GNU General Public License v3.0 6 votes vote down vote up
@Override
public void configureMessageBroker(final MessageBrokerRegistry config)
{
	// use the /topic prefix for outgoing WebSocket communication
	config.enableSimpleBroker(
			TOPIC_UserSession,
			TOPIC_Notifications,
			TOPIC_View,
			TOPIC_Document,
			TOPIC_Board,
			TOPIC_Dashboard,
			TOPIC_Devices);

	// use the /app prefix for others
	config.setApplicationDestinationPrefixes("/app");
}
 
Example #4
Source File: WebSocketConfig.java    From zuul-websocket-support-demo with Apache License 2.0 5 votes vote down vote up
@Override
public void configureMessageBroker(MessageBrokerRegistry config) {
	// prefix for subscribe
	config.enableSimpleBroker("/topic");
	// prefix for send
	config.setApplicationDestinationPrefixes("/app");
}
 
Example #5
Source File: WebSocketConfig.java    From tutorial with MIT License 5 votes vote down vote up
@Override
public void configureMessageBroker(MessageBrokerRegistry config) {
    // 只有用enableSimpleBroker打开的地址前缀才可以在程序中使用,使用没设置enable的前缀时不会出错,但无法传递消息
    config.enableSimpleBroker("/topic");

    // @MessageMapping注解的设置的地址的会和这个前缀一起构成客户端需要声明的地址(stompClient.send()方法的第一个参数)
    config.setApplicationDestinationPrefixes("/app");
}
 
Example #6
Source File: WebSocketStompConfig.java    From Project with Apache License 2.0 5 votes vote down vote up
@Override
	public void configureMessageBroker(MessageBrokerRegistry registry) {
////		启用了STOMP代理中继,如RabbitMQ或ActiveMQ
//		registry.enableStompBrokerRelay("/queue", "/topic")
////			//默认值
////			.setRelayHost("localhost")
////			.setRelayPort(61613)
////			.setClientLogin("marcopolo")
////			.setClientPasscode("guest")
//			;
		registry.enableSimpleBroker("/queue", "/topic");// 基于内存
		registry.setApplicationDestinationPrefixes("/app");
	}
 
Example #7
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 #8
Source File: WebSocketConfig.java    From joal with Apache License 2.0 5 votes vote down vote up
@Override
public void configureMessageBroker(final MessageBrokerRegistry config) {
    config.enableSimpleBroker(
            "/global",
            "/announce",
            "/config",
            "/torrents",
            "/speed"
    );
    // Message received with one of those destinationPrefixes will be automatically router to controllers @MessageMapping
    config.setApplicationDestinationPrefixes("/joal");
}
 
Example #9
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 #10
Source File: WebSocketConfig.java    From AxonBank with Apache License 2.0 5 votes vote down vote up
@Override
public void configureMessageBroker(MessageBrokerRegistry config) {
    if (ArrayUtils.contains(environment.getActiveProfiles(), "distributed-command-bus")) {
        config.enableStompBrokerRelay("/topic")
              .setRelayHost("rabbitmq");
    } else {
        config.enableSimpleBroker("/topic");
    }
    config.setApplicationDestinationPrefixes("/app");
}
 
Example #11
Source File: WebSocketConfig.java    From spring-boot-start-current with Apache License 2.0 5 votes vote down vote up
/**
 * 定义消息代理,设置消息连接请求的各种规范信息.
 *
 * @param config 消息代理注册
 */
@Override
public void configureMessageBroker ( MessageBrokerRegistry config ) {
	// Server前缀,指服务端接收地址的前缀,意思就是说客户端给服务端发消息的地址的前缀
	config.setApplicationDestinationPrefixes( serverApplicationDestinationPrefixes );
	// Client前缀,表示客户端订阅地址的前缀信息,也就是客户端接收服务端消息的地址的前缀信息
	config.enableSimpleBroker( clientBrokerDestinationPrefixes );
}
 
Example #12
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 #13
Source File: WebSocketConfig.java    From kafka-webview with MIT License 4 votes vote down vote up
@Override
public void configureMessageBroker(MessageBrokerRegistry config) {
    // Where messages published from the server side are published to.
    // OR ... the prefix for where consumers subscribe.
    config.enableSimpleBroker("/topic");

    //Controller end point prefixes, where consumers publish messages TO.
    config.setApplicationDestinationPrefixes("/websocket");
}
 
Example #14
Source File: WebSocketConfig.java    From lambda-arch with Apache License 2.0 4 votes vote down vote up
@Override
public void configureMessageBroker(MessageBrokerRegistry config) {
    config.enableSimpleBroker("/topic");
}
 
Example #15
Source File: WebSocketConfig.java    From k8s-fleetman with MIT License 4 votes vote down vote up
@Override
public void configureMessageBroker(MessageBrokerRegistry config)
{
    config.enableSimpleBroker("/vehiclepositions");
    config.setApplicationDestinationPrefixes("/app");
}
 
Example #16
Source File: WebsocketConfig.java    From cloudbreak with Apache License 2.0 4 votes vote down vote up
@Override
public void configureMessageBroker(MessageBrokerRegistry config) {
    config.enableSimpleBroker("/topic");
    config.setApplicationDestinationPrefixes("/app");
}
 
Example #17
Source File: WebsocketTest.java    From java-spring-cloud with Apache License 2.0 4 votes vote down vote up
@Override
public void configureMessageBroker(MessageBrokerRegistry config) {
  config.enableSimpleBroker("/topic");
  config.setApplicationDestinationPrefixes("/app");
}
 
Example #18
Source File: WebSocketConfig.java    From servicecomb-pack with Apache License 2.0 4 votes vote down vote up
@Override
public void configureMessageBroker(MessageBrokerRegistry config) {
  config.enableSimpleBroker("/topic");
}
 
Example #19
Source File: WebSocketConfig.java    From java-spring-cloud 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: 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 #21
Source File: WebSocketConfig.java    From tutorials with MIT License 4 votes vote down vote up
@Override
public void configureMessageBroker(final MessageBrokerRegistry config) {
    config.enableSimpleBroker("/topic");
    config.setApplicationDestinationPrefixes("/app");
}
 
Example #22
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 #23
Source File: WebSocketConfig.java    From glowroot with Apache License 2.0 4 votes vote down vote up
@Override
public void configureMessageBroker(MessageBrokerRegistry config) {
    config.enableSimpleBroker("/destination");
    config.setApplicationDestinationPrefixes("/app");
}
 
Example #24
Source File: WebSocketConfig.java    From Hands-On-Microservices-with-Spring-Boot-2.0 with MIT License 4 votes vote down vote up
@Override
public void configureMessageBroker(MessageBrokerRegistry config) {
    config.enableSimpleBroker("/topic");
    config.setApplicationDestinationPrefixes("/app");
}
 
Example #25
Source File: WebSocketConfig.java    From spring-boot-samples with Apache License 2.0 4 votes vote down vote up
@Override
public void configureMessageBroker(MessageBrokerRegistry config) {
	config.enableSimpleBroker("/topic");
	config.setApplicationDestinationPrefixes("/app");
}
 
Example #26
Source File: WebSocketConfig.java    From pro-spring-boot with Apache License 2.0 4 votes vote down vote up
@Override
public void configureMessageBroker(MessageBrokerRegistry config) {
    config.enableSimpleBroker("/topic");
    config.setApplicationDestinationPrefixes("/app");
}
 
Example #27
Source File: _WebsocketConfiguration.java    From jhipster-ribbon-hystrix with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void configureMessageBroker(MessageBrokerRegistry config) {
    config.enableSimpleBroker("/topic");
}
 
Example #28
Source File: WebSocketConfig.java    From spring-websocket-server with MIT License 4 votes vote down vote up
@Override
public void configureMessageBroker(MessageBrokerRegistry config)
{
    config.enableSimpleBroker("/topic");
    config.setApplicationDestinationPrefixes("/app");
}
 
Example #29
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 #30
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");
}