Search in sources :

Example 6 with SimpleMessageListenerContainer

use of org.springframework.jms.listener.SimpleMessageListenerContainer in project av-service by dvoraka.

the class JmsBridgeOutputConfig method outMessageListenerContainer.

@Bean
public SimpleMessageListenerContainer outMessageListenerContainer(ConnectionFactory outConnectionFactory, MessageListener outMessageListener) {
    SimpleMessageListenerContainer container = new SimpleMessageListenerContainer();
    container.setConnectionFactory(outConnectionFactory);
    container.setDestinationName(resultDestination);
    container.setMessageListener(outMessageListener);
    return container;
}
Also used : SimpleMessageListenerContainer(org.springframework.jms.listener.SimpleMessageListenerContainer) Bean(org.springframework.context.annotation.Bean)

Example 7 with SimpleMessageListenerContainer

use of org.springframework.jms.listener.SimpleMessageListenerContainer in project av-service by dvoraka.

the class JmsFileClientConfig method messageListenerContainer.

@Bean
public SimpleMessageListenerContainer messageListenerContainer(ConnectionFactory connectionFactory, MessageListener messageListener) {
    SimpleMessageListenerContainer container = new SimpleMessageListenerContainer();
    container.setConnectionFactory(connectionFactory);
    container.setDestinationName(resultDestination);
    container.setMessageListener(messageListener);
    return container;
}
Also used : SimpleMessageListenerContainer(org.springframework.jms.listener.SimpleMessageListenerContainer) Bean(org.springframework.context.annotation.Bean)

Example 8 with SimpleMessageListenerContainer

use of org.springframework.jms.listener.SimpleMessageListenerContainer in project camel by apache.

the class JmsEndpointConfigurationTest method testCreateSimpleMessageListener.

@Test
public void testCreateSimpleMessageListener() throws Exception {
    JmsEndpoint endpoint = resolveMandatoryEndpoint("jms:Foo.Bar?consumerType=Simple", JmsEndpoint.class);
    JmsConsumer consumer = endpoint.createConsumer(dummyProcessor);
    AbstractMessageListenerContainer container = consumer.getListenerContainer();
    assertTrue("Should have been a SimpleMessageListenerContainer", container instanceof SimpleMessageListenerContainer);
}
Also used : SimpleMessageListenerContainer(org.springframework.jms.listener.SimpleMessageListenerContainer) AbstractMessageListenerContainer(org.springframework.jms.listener.AbstractMessageListenerContainer) Test(org.junit.Test)

Example 9 with SimpleMessageListenerContainer

use of org.springframework.jms.listener.SimpleMessageListenerContainer in project spring-framework by spring-projects.

the class JmsListenerContainerFactoryTests method createSimpleContainer.

@Test
public void createSimpleContainer() {
    SimpleJmsListenerContainerFactory factory = new SimpleJmsListenerContainerFactory();
    setDefaultJmsConfig(factory);
    SimpleJmsListenerEndpoint endpoint = new SimpleJmsListenerEndpoint();
    MessageListener messageListener = new MessageListenerAdapter();
    endpoint.setMessageListener(messageListener);
    endpoint.setDestination("myQueue");
    SimpleMessageListenerContainer container = factory.createListenerContainer(endpoint);
    assertDefaultJmsConfig(container);
    assertEquals(messageListener, container.getMessageListener());
    assertEquals("myQueue", container.getDestinationName());
}
Also used : MessageListenerAdapter(org.springframework.jms.listener.adapter.MessageListenerAdapter) MessageListener(javax.jms.MessageListener) SimpleMessageListenerContainer(org.springframework.jms.listener.SimpleMessageListenerContainer) Test(org.junit.Test)

Example 10 with SimpleMessageListenerContainer

use of org.springframework.jms.listener.SimpleMessageListenerContainer in project spring-framework by spring-projects.

the class MethodJmsListenerEndpointTests method processAndReplyWithSendToTopic.

@Test
public void processAndReplyWithSendToTopic() throws JMSException {
    String methodName = "processAndReplyWithSendTo";
    SimpleMessageListenerContainer container = new SimpleMessageListenerContainer();
    container.setPubSubDomain(true);
    MessagingMessageListenerAdapter listener = createInstance(this.factory, getListenerMethod(methodName, String.class), container);
    processAndReplyWithSendTo(listener, "replyDestination", true);
    assertListenerMethodInvocation(sample, methodName);
}
Also used : MessagingMessageListenerAdapter(org.springframework.jms.listener.adapter.MessagingMessageListenerAdapter) SimpleMessageListenerContainer(org.springframework.jms.listener.SimpleMessageListenerContainer) Test(org.junit.Test)

Aggregations

SimpleMessageListenerContainer (org.springframework.jms.listener.SimpleMessageListenerContainer)13 Test (org.junit.Test)8 MessagingMessageListenerAdapter (org.springframework.jms.listener.adapter.MessagingMessageListenerAdapter)5 Bean (org.springframework.context.annotation.Bean)3 MessageListener (javax.jms.MessageListener)2 JmsListenerContainerTestFactory (org.springframework.jms.config.JmsListenerContainerTestFactory)2 MethodJmsListenerEndpoint (org.springframework.jms.config.MethodJmsListenerEndpoint)2 MessageListenerAdapter (org.springframework.jms.listener.adapter.MessageListenerAdapter)2 Session (javax.jms.Session)1 DirectFieldAccessor (org.springframework.beans.DirectFieldAccessor)1 ConfigurableApplicationContext (org.springframework.context.ConfigurableApplicationContext)1 AnnotationConfigApplicationContext (org.springframework.context.annotation.AnnotationConfigApplicationContext)1 StubTextMessage (org.springframework.jms.StubTextMessage)1 AbstractJmsListenerEndpoint (org.springframework.jms.config.AbstractJmsListenerEndpoint)1 JmsListenerEndpoint (org.springframework.jms.config.JmsListenerEndpoint)1 MessageListenerTestContainer (org.springframework.jms.config.MessageListenerTestContainer)1 AbstractMessageListenerContainer (org.springframework.jms.listener.AbstractMessageListenerContainer)1 DefaultMessageListenerContainer (org.springframework.jms.listener.DefaultMessageListenerContainer)1 ErrorHandler (org.springframework.util.ErrorHandler)1