Search in sources :

Example 16 with MessageHandler

use of org.springframework.messaging.MessageHandler in project spring-framework by spring-projects.

the class ExecutorSubscribableChannelTests method failurePropagates.

@Test
public void failurePropagates() throws Exception {
    RuntimeException ex = new RuntimeException();
    willThrow(ex).given(this.handler).handleMessage(this.message);
    MessageHandler secondHandler = mock(MessageHandler.class);
    this.channel.subscribe(this.handler);
    this.channel.subscribe(secondHandler);
    try {
        this.channel.send(message);
    } catch (MessageDeliveryException actualException) {
        assertThat(actualException.getCause(), equalTo(ex));
    }
    verifyZeroInteractions(secondHandler);
}
Also used : MessageHandler(org.springframework.messaging.MessageHandler) MessageDeliveryException(org.springframework.messaging.MessageDeliveryException) Test(org.junit.Test)

Example 17 with MessageHandler

use of org.springframework.messaging.MessageHandler in project spring-framework by spring-projects.

the class MessageBrokerConfigurationTests method userBroadcastsDisabledWithSimpleBroker.

@Test
public void userBroadcastsDisabledWithSimpleBroker() throws Exception {
    SimpUserRegistry registry = this.simpleBrokerContext.getBean(SimpUserRegistry.class);
    assertNotNull(registry);
    assertNotEquals(MultiServerUserRegistry.class, registry.getClass());
    UserDestinationMessageHandler handler = this.simpleBrokerContext.getBean(UserDestinationMessageHandler.class);
    assertNull(handler.getBroadcastDestination());
    String name = "userRegistryMessageHandler";
    MessageHandler messageHandler = this.simpleBrokerContext.getBean(name, MessageHandler.class);
    assertNotEquals(UserRegistryMessageHandler.class, messageHandler.getClass());
}
Also used : StompBrokerRelayMessageHandler(org.springframework.messaging.simp.stomp.StompBrokerRelayMessageHandler) MessageHandler(org.springframework.messaging.MessageHandler) SimpleBrokerMessageHandler(org.springframework.messaging.simp.broker.SimpleBrokerMessageHandler) UserRegistryMessageHandler(org.springframework.messaging.simp.user.UserRegistryMessageHandler) UserDestinationMessageHandler(org.springframework.messaging.simp.user.UserDestinationMessageHandler) SimpAnnotationMethodMessageHandler(org.springframework.messaging.simp.annotation.support.SimpAnnotationMethodMessageHandler) UserDestinationMessageHandler(org.springframework.messaging.simp.user.UserDestinationMessageHandler) SimpUserRegistry(org.springframework.messaging.simp.user.SimpUserRegistry) Test(org.junit.Test)

Aggregations

MessageHandler (org.springframework.messaging.MessageHandler)17 Test (org.junit.Test)14 SimpleBrokerMessageHandler (org.springframework.messaging.simp.broker.SimpleBrokerMessageHandler)8 UserDestinationMessageHandler (org.springframework.messaging.simp.user.UserDestinationMessageHandler)8 SimpAnnotationMethodMessageHandler (org.springframework.messaging.simp.annotation.support.SimpAnnotationMethodMessageHandler)6 StompBrokerRelayMessageHandler (org.springframework.messaging.simp.stomp.StompBrokerRelayMessageHandler)6 UserRegistryMessageHandler (org.springframework.messaging.simp.user.UserRegistryMessageHandler)6 CountDownLatch (java.util.concurrent.CountDownLatch)5 MessageChannel (org.springframework.messaging.MessageChannel)5 GenericMessage (org.springframework.messaging.support.GenericMessage)5 DirectChannel (org.springframework.integration.channel.DirectChannel)4 HashMap (java.util.HashMap)3 SimpUserRegistry (org.springframework.messaging.simp.user.SimpUserRegistry)3 ChannelInterceptor (org.springframework.messaging.support.ChannelInterceptor)3 ImmutableMessageChannelInterceptor (org.springframework.messaging.support.ImmutableMessageChannelInterceptor)3 SubProtocolWebSocketHandler (org.springframework.web.socket.messaging.SubProtocolWebSocketHandler)3 NoSuchBeanDefinitionException (org.springframework.beans.factory.NoSuchBeanDefinitionException)2 ApplicationContext (org.springframework.context.ApplicationContext)2 AnnotationConfigApplicationContext (org.springframework.context.annotation.AnnotationConfigApplicationContext)2 MessageDeliveryException (org.springframework.messaging.MessageDeliveryException)2