Search in sources :

Example 6 with StompBrokerRelayMessageHandler

use of org.springframework.messaging.simp.stomp.StompBrokerRelayMessageHandler in project spring-framework by spring-projects.

the class MessageBrokerConfigurationTests method userBroadcasts.

@Test
public void userBroadcasts() throws Exception {
    SimpUserRegistry userRegistry = this.brokerRelayContext.getBean(SimpUserRegistry.class);
    assertEquals(MultiServerUserRegistry.class, userRegistry.getClass());
    UserDestinationMessageHandler handler1 = this.brokerRelayContext.getBean(UserDestinationMessageHandler.class);
    assertEquals("/topic/unresolved-user-destination", handler1.getBroadcastDestination());
    UserRegistryMessageHandler handler2 = this.brokerRelayContext.getBean(UserRegistryMessageHandler.class);
    assertEquals("/topic/simp-user-registry", handler2.getBroadcastDestination());
    StompBrokerRelayMessageHandler relay = this.brokerRelayContext.getBean(StompBrokerRelayMessageHandler.class);
    assertNotNull(relay.getSystemSubscriptions());
    assertEquals(2, relay.getSystemSubscriptions().size());
    assertSame(handler1, relay.getSystemSubscriptions().get("/topic/unresolved-user-destination"));
    assertSame(handler2, relay.getSystemSubscriptions().get("/topic/simp-user-registry"));
}
Also used : UserRegistryMessageHandler(org.springframework.messaging.simp.user.UserRegistryMessageHandler) StompBrokerRelayMessageHandler(org.springframework.messaging.simp.stomp.StompBrokerRelayMessageHandler) UserDestinationMessageHandler(org.springframework.messaging.simp.user.UserDestinationMessageHandler) SimpUserRegistry(org.springframework.messaging.simp.user.SimpUserRegistry) Test(org.junit.Test)

Aggregations

StompBrokerRelayMessageHandler (org.springframework.messaging.simp.stomp.StompBrokerRelayMessageHandler)6 Test (org.junit.Test)3 UserDestinationMessageHandler (org.springframework.messaging.simp.user.UserDestinationMessageHandler)3 UserRegistryMessageHandler (org.springframework.messaging.simp.user.UserRegistryMessageHandler)3 Bean (org.springframework.context.annotation.Bean)2 MessageHandler (org.springframework.messaging.MessageHandler)2 SimpAnnotationMethodMessageHandler (org.springframework.messaging.simp.annotation.support.SimpAnnotationMethodMessageHandler)2 AbstractBrokerMessageHandler (org.springframework.messaging.simp.broker.AbstractBrokerMessageHandler)2 SimpleBrokerMessageHandler (org.springframework.messaging.simp.broker.SimpleBrokerMessageHandler)2 SimpUserRegistry (org.springframework.messaging.simp.user.SimpUserRegistry)2 HashMap (java.util.HashMap)1 NoSuchBeanDefinitionException (org.springframework.beans.factory.NoSuchBeanDefinitionException)1 MessageChannel (org.springframework.messaging.MessageChannel)1 StubMessageChannel (org.springframework.messaging.StubMessageChannel)1 SubscribableChannel (org.springframework.messaging.SubscribableChannel)1 DefaultUserDestinationResolver (org.springframework.messaging.simp.user.DefaultUserDestinationResolver)1 UserDestinationResolver (org.springframework.messaging.simp.user.UserDestinationResolver)1 HttpRequestHandler (org.springframework.web.HttpRequestHandler)1 HandlerMapping (org.springframework.web.servlet.HandlerMapping)1 SimpleUrlHandlerMapping (org.springframework.web.servlet.handler.SimpleUrlHandlerMapping)1