use of org.springframework.jms.listener.AbstractMessageListenerContainer in project camel by apache.
the class JmsConfiguration method createMessageListenerContainer.
public AbstractMessageListenerContainer createMessageListenerContainer(JmsEndpoint endpoint) throws Exception {
AbstractMessageListenerContainer container = chooseMessageListenerContainerImplementation(endpoint);
configureMessageListenerContainer(container, endpoint);
return container;
}
use of org.springframework.jms.listener.AbstractMessageListenerContainer in project camel by apache.
the class JmsEndpointConfigurationTest method testConfigureMessageListener.
@Test
public void testConfigureMessageListener() throws Exception {
JmsEndpoint endpoint = resolveMandatoryEndpoint("jms:Foo.Bar?disableReplyTo=true&eagerLoadingOfProperties=true", JmsEndpoint.class);
JmsConsumer consumer = endpoint.createConsumer(dummyProcessor);
AbstractMessageListenerContainer container = consumer.getListenerContainer();
Object object = container.getMessageListener();
EndpointMessageListener messageListener = assertIsInstanceOf(EndpointMessageListener.class, object);
assertTrue("Should have replyToDisabled", messageListener.isDisableReplyTo());
assertTrue("Should have isEagerLoadingOfProperties()", messageListener.isEagerLoadingOfProperties());
}
use of org.springframework.jms.listener.AbstractMessageListenerContainer in project camel by apache.
the class JmsEndpointConfigurationTest method testSessionTransacted.
@Test
public void testSessionTransacted() throws Exception {
JmsEndpoint endpoint = resolveMandatoryEndpoint("jms:queue:Foo?transacted=true&lazyCreateTransactionManager=false", JmsEndpoint.class);
AbstractMessageListenerContainer container = endpoint.createConsumer(dummyProcessor).getListenerContainer();
assertTrue("The JMS sessions will not be transactional!", container.isSessionTransacted());
assertFalse("The transactionManager gets lazily generated!", endpoint.isLazyCreateTransactionManager());
assertNull("The endpoint has an injected TransactionManager!", endpoint.getTransactionManager());
endpoint = resolveMandatoryEndpoint("jms:queue:Foo?transacted=true", JmsEndpoint.class);
container = endpoint.createConsumer(dummyProcessor).getListenerContainer();
assertTrue("The JMS sessions will not be transactional!", container.isSessionTransacted());
assertTrue("The transactionManager doesn't get lazily generated!", endpoint.isLazyCreateTransactionManager());
assertNotNull("The endpoint has no injected TransactionManager!", endpoint.getTransactionManager());
}
use of org.springframework.jms.listener.AbstractMessageListenerContainer in project camel by apache.
the class JmsEndpointConfigurationTest method assertCacheLevel.
protected void assertCacheLevel(JmsEndpoint endpoint, int expected) throws Exception {
JmsConsumer consumer = endpoint.createConsumer(dummyProcessor);
AbstractMessageListenerContainer container = consumer.getListenerContainer();
DefaultMessageListenerContainer defaultContainer = assertIsInstanceOf(DefaultMessageListenerContainer.class, container);
int cacheLevel = defaultContainer.getCacheLevel();
assertEquals("CacheLevel", expected, cacheLevel);
}
use of org.springframework.jms.listener.AbstractMessageListenerContainer in project camel by apache.
the class JmsEndpointConfigurationTest method assertDurableSubscriberEndpointIsValid.
protected void assertDurableSubscriberEndpointIsValid(JmsEndpoint endpoint) throws Exception {
JmsConfiguration configuration = endpoint.getConfiguration();
assertEquals("getDurableSubscriptionName()", "James", configuration.getDurableSubscriptionName());
assertEquals("getClientId()", "ABC", configuration.getClientId());
assertEquals("isDeliveryPersistent()", true, configuration.isDeliveryPersistent());
JmsConsumer consumer = endpoint.createConsumer(new Processor() {
public void process(Exchange exchange) throws Exception {
log.info("Received: " + exchange);
}
});
AbstractMessageListenerContainer listenerContainer = consumer.getListenerContainer();
assertEquals("getDurableSubscriptionName()", "James", listenerContainer.getDurableSubscriptionName());
assertEquals("getClientId()", "ABC", listenerContainer.getClientId());
assertEquals("isSubscriptionDurable()", true, listenerContainer.isSubscriptionDurable());
}
Aggregations