use of org.springframework.jms.listener.DefaultMessageListenerContainer in project opennms by OpenNMS.
the class AppConfig method listenerContainer.
//
// JMS DLMC
//
@Bean(name = "listenerContainer")
public AbstractMessageListenerContainer listenerContainer() {
DefaultMessageListenerContainer listenerContainer = new DefaultMessageListenerContainer();
listenerContainer.setConnectionFactory(connectionFactory());
listenerContainer.setConcurrentConsumers(16);
listenerContainer.setMaxConcurrentConsumers(16);
listenerContainer.setDestinationName("NrtCollectMe");
listenerContainer.setMessageListener(new CollectionJobListener(jmsTemplate()));
return listenerContainer;
}
use of org.springframework.jms.listener.DefaultMessageListenerContainer in project opennms by OpenNMS.
the class AppConfig method listenerContainer.
//
// JMS DLMC
//
@Bean(name = "listenerContainer")
public AbstractMessageListenerContainer listenerContainer() {
CollectionJobListener collectionJobListener = new CollectionJobListener(jmsTemplate());
collectionJobListener.setProtocolCollectorRegistry(protocolCollectorRegistry());
DefaultMessageListenerContainer listenerContainer = new DefaultMessageListenerContainer();
listenerContainer.setConnectionFactory(connectionFactory());
listenerContainer.setConcurrentConsumers(16);
listenerContainer.setMaxConcurrentConsumers(16);
listenerContainer.setDestinationName("NrtCollectMe");
listenerContainer.setMessageListener(collectionJobListener);
return listenerContainer;
}
use of org.springframework.jms.listener.DefaultMessageListenerContainer in project spring-framework by spring-projects.
the class JmsListenerContainerFactoryTests method backOffOverridesRecoveryInterval.
@Test
public void backOffOverridesRecoveryInterval() {
DefaultJmsListenerContainerFactory factory = new DefaultJmsListenerContainerFactory();
BackOff backOff = new FixedBackOff();
factory.setBackOff(backOff);
factory.setRecoveryInterval(2000L);
SimpleJmsListenerEndpoint endpoint = new SimpleJmsListenerEndpoint();
MessageListener messageListener = new MessageListenerAdapter();
endpoint.setMessageListener(messageListener);
endpoint.setDestination("myQueue");
DefaultMessageListenerContainer container = factory.createListenerContainer(endpoint);
assertSame(backOff, new DirectFieldAccessor(container).getPropertyValue("backOff"));
}
use of org.springframework.jms.listener.DefaultMessageListenerContainer in project spring-framework by spring-projects.
the class JmsListenerEndpointTests method setupMessageContainerNoListener.
@Test
public void setupMessageContainerNoListener() {
DefaultMessageListenerContainer container = new DefaultMessageListenerContainer();
SimpleJmsListenerEndpoint endpoint = new SimpleJmsListenerEndpoint();
thrown.expect(IllegalStateException.class);
endpoint.setupListenerContainer(container);
}
use of org.springframework.jms.listener.DefaultMessageListenerContainer in project spring-framework by spring-projects.
the class JmsNamespaceHandlerTests method testConcurrency.
@Test
public void testConcurrency() {
// JMS
DefaultMessageListenerContainer listener0 = this.context.getBean(DefaultMessageListenerContainer.class.getName() + "#0", DefaultMessageListenerContainer.class);
DefaultMessageListenerContainer listener1 = this.context.getBean("listener1", DefaultMessageListenerContainer.class);
DefaultMessageListenerContainer listener2 = this.context.getBean("listener2", DefaultMessageListenerContainer.class);
assertEquals("Wrong concurrency on listener using placeholder", 2, listener0.getConcurrentConsumers());
assertEquals("Wrong concurrency on listener using placeholder", 3, listener0.getMaxConcurrentConsumers());
assertEquals("Wrong concurrency on listener1", 3, listener1.getConcurrentConsumers());
assertEquals("Wrong max concurrency on listener1", 5, listener1.getMaxConcurrentConsumers());
assertEquals("Wrong custom concurrency on listener2", 5, listener2.getConcurrentConsumers());
assertEquals("Wrong custom max concurrency on listener2", 10, listener2.getMaxConcurrentConsumers());
// JCA
JmsMessageEndpointManager listener3 = this.context.getBean("listener3", JmsMessageEndpointManager.class);
JmsMessageEndpointManager listener4 = this.context.getBean("listener4", JmsMessageEndpointManager.class);
assertEquals("Wrong concurrency on listener3", 5, listener3.getActivationSpecConfig().getMaxConcurrency());
assertEquals("Wrong custom concurrency on listener4", 7, listener4.getActivationSpecConfig().getMaxConcurrency());
}
Aggregations