Java Code Examples for org.springframework.messaging.simp.config.SimpleBrokerRegistration

Following code examples demonstrate how to use org.springframework.messaging.simp.config.SimpleBrokerRegistrationfrom spring-framework. These examples are extracted from various highly rated open source projects. You can directly use these code snippets or view their entire linked source code. These snippets are extracted to provide contextual information about how to use this class in the real world. These samples also let you understand some good practices on how to use org.springframework.messaging.simp.config.SimpleBrokerRegistrationand various code implementation of this class.

    public void testConfigureMessageBroker() {
        resetAll();
        expect(messageBrokerRegistry.enableSimpleBroker("/queue/", "/topic/", "/user")).andReturn(simpleBrokerRegistration);
        expect(messageBrokerRegistry.setApplicationDestinationPrefixes("/app")).andReturn(messageBrokerRegistry);
        replayAll();
        webSocketConfig.configureMessageBroker(messageBrokerRegistry);
        verifyAll();
    } 


    public void configureMessageBroker(MessageBrokerRegistry registry) {
         SimpleBrokerRegistration simpleBrokerRegistration = registry.enableSimpleBroker("/queue", "/topic");
         registry.setApplicationDestinationPrefixes("/app");
         simpleBrokerRegistration.setTaskScheduler(messageBrokerSockJsTaskScheduler());
         long [] hbeat = {40000,40000};
         simpleBrokerRegistration.setHeartbeatValue(hbeat);


    } 

    public void configureMessageBroker(MessageBrokerRegistry config) {
        myLogger.info("Configuring message broker.");
        SimpleBrokerRegistration broker = config.enableSimpleBroker("/topic");
        if (myScheduler != null) {
            myLogger.info("Enabling task scheduling.");
            broker.setTaskScheduler(myScheduler);
        }
        else {
            myLogger.warn("No task scheduler available.");
        }
        config.setApplicationDestinationPrefixes("/app");

    } 

Advertisement
Javadoc
Registration class for configuring a SimpleBrokerMessageHandler. @author Rossen Stoyanchev @since 4.

0

Read More
Advertisement