use of org.springframework.jms.listener.adapter.MessageListenerAdapter in project spring-framework by spring-projects.
the class JmsListenerContainerFactoryTests method createJmsContainerFullConfig.
@Test
public void createJmsContainerFullConfig() {
DefaultJmsListenerContainerFactory factory = new DefaultJmsListenerContainerFactory();
setDefaultJmsConfig(factory);
factory.setCacheLevel(DefaultMessageListenerContainer.CACHE_CONSUMER);
factory.setConcurrency("3-10");
factory.setMaxMessagesPerTask(5);
SimpleJmsListenerEndpoint endpoint = new SimpleJmsListenerEndpoint();
MessageListener messageListener = new MessageListenerAdapter();
endpoint.setMessageListener(messageListener);
endpoint.setDestination("myQueue");
DefaultMessageListenerContainer container = factory.createListenerContainer(endpoint);
assertDefaultJmsConfig(container);
assertEquals(DefaultMessageListenerContainer.CACHE_CONSUMER, container.getCacheLevel());
assertEquals(3, container.getConcurrentConsumers());
assertEquals(10, container.getMaxConcurrentConsumers());
assertEquals(5, container.getMaxMessagesPerTask());
assertEquals(messageListener, container.getMessageListener());
assertEquals("myQueue", container.getDestinationName());
}
use of org.springframework.jms.listener.adapter.MessageListenerAdapter in project spring-framework by spring-projects.
the class JmsListenerContainerFactoryTests method jcaExclusiveProperties.
@Test
public void jcaExclusiveProperties() {
DefaultJcaListenerContainerFactory factory = new DefaultJcaListenerContainerFactory();
factory.setDestinationResolver(destinationResolver);
factory.setActivationSpecFactory(new StubJmsActivationSpecFactory());
SimpleJmsListenerEndpoint endpoint = new SimpleJmsListenerEndpoint();
endpoint.setMessageListener(new MessageListenerAdapter());
thrown.expect(IllegalStateException.class);
factory.createListenerContainer(endpoint);
}
use of org.springframework.jms.listener.adapter.MessageListenerAdapter in project spring-framework by spring-projects.
the class SimpleJmsListenerEndpointTests method createListener.
@Test
public void createListener() {
SimpleJmsListenerEndpoint endpoint = new SimpleJmsListenerEndpoint();
MessageListener messageListener = new MessageListenerAdapter();
endpoint.setMessageListener(messageListener);
assertSame(messageListener, endpoint.createMessageListener(container));
}
use of org.springframework.jms.listener.adapter.MessageListenerAdapter in project spring-framework by spring-projects.
the class JmsListenerEndpointTests method setupJmsMessageContainerFullConfig.
@Test
public void setupJmsMessageContainerFullConfig() {
DefaultMessageListenerContainer container = new DefaultMessageListenerContainer();
MessageListener messageListener = new MessageListenerAdapter();
SimpleJmsListenerEndpoint endpoint = new SimpleJmsListenerEndpoint();
endpoint.setDestination("myQueue");
endpoint.setSelector("foo = 'bar'");
endpoint.setSubscription("mySubscription");
endpoint.setConcurrency("5-10");
endpoint.setMessageListener(messageListener);
endpoint.setupListenerContainer(container);
assertEquals("myQueue", container.getDestinationName());
assertEquals("foo = 'bar'", container.getMessageSelector());
assertEquals("mySubscription", container.getSubscriptionName());
assertEquals(5, container.getConcurrentConsumers());
assertEquals(10, container.getMaxConcurrentConsumers());
assertEquals(messageListener, container.getMessageListener());
}
use of org.springframework.jms.listener.adapter.MessageListenerAdapter in project spring-framework by spring-projects.
the class JmsListenerEndpointTests method setupConcurrencySimpleContainer.
@Test
public void setupConcurrencySimpleContainer() {
SimpleMessageListenerContainer container = new SimpleMessageListenerContainer();
MessageListener messageListener = new MessageListenerAdapter();
SimpleJmsListenerEndpoint endpoint = new SimpleJmsListenerEndpoint();
// simple implementation only support max value
endpoint.setConcurrency("5-10");
endpoint.setMessageListener(messageListener);
endpoint.setupListenerContainer(container);
assertEquals(10, new DirectFieldAccessor(container).getPropertyValue("concurrentConsumers"));
}
Aggregations