use of org.springframework.jms.listener.DefaultMessageListenerContainer in project spring-framework by spring-projects.
the class JmsNamespaceHandlerTests method testResponseDestination.
@Test
public void testResponseDestination() {
// JMS
DefaultMessageListenerContainer listener1 = this.context.getBean("listener1", DefaultMessageListenerContainer.class);
DefaultMessageListenerContainer listener2 = this.context.getBean("listener2", DefaultMessageListenerContainer.class);
assertEquals("Wrong destination type on listener1", true, listener1.isPubSubDomain());
assertEquals("Wrong destination type on listener2", true, listener2.isPubSubDomain());
assertEquals("Wrong response destination type on listener1", false, listener1.isReplyPubSubDomain());
assertEquals("Wrong response destination type on listener2", false, listener2.isReplyPubSubDomain());
// JCA
JmsMessageEndpointManager listener3 = this.context.getBean("listener3", JmsMessageEndpointManager.class);
JmsMessageEndpointManager listener4 = this.context.getBean("listener4", JmsMessageEndpointManager.class);
assertEquals("Wrong destination type on listener3", true, listener3.isPubSubDomain());
assertEquals("Wrong destination type on listener4", true, listener4.isPubSubDomain());
assertEquals("Wrong response destination type on listener3", false, listener3.isReplyPubSubDomain());
assertEquals("Wrong response destination type on listener4", false, listener4.isReplyPubSubDomain());
}
use of org.springframework.jms.listener.DefaultMessageListenerContainer in project spring-framework by spring-projects.
the class JmsNamespaceHandlerTests method testContainerConfiguration.
@Test
public void testContainerConfiguration() throws Exception {
Map<String, DefaultMessageListenerContainer> containers = context.getBeansOfType(DefaultMessageListenerContainer.class);
ConnectionFactory defaultConnectionFactory = context.getBean(DEFAULT_CONNECTION_FACTORY, ConnectionFactory.class);
ConnectionFactory explicitConnectionFactory = context.getBean(EXPLICIT_CONNECTION_FACTORY, ConnectionFactory.class);
int defaultConnectionFactoryCount = 0;
int explicitConnectionFactoryCount = 0;
for (DefaultMessageListenerContainer container : containers.values()) {
if (container.getConnectionFactory().equals(defaultConnectionFactory)) {
defaultConnectionFactoryCount++;
} else if (container.getConnectionFactory().equals(explicitConnectionFactory)) {
explicitConnectionFactoryCount++;
}
}
assertEquals("1 container should have the default connectionFactory", 1, defaultConnectionFactoryCount);
assertEquals("2 containers should have the explicit connectionFactory", 2, explicitConnectionFactoryCount);
}
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 simba-os by cegeka.
the class EventServiceConfiguration method jmsContainer.
@Bean
public DefaultMessageListenerContainer jmsContainer() {
DefaultMessageListenerContainer container = new DefaultMessageListenerContainer();
container.setConnectionFactory(connectionFactory);
container.setDestination(destination);
container.setMessageListener(messageListener);
container.start();
return container;
}
Aggregations