Java Code Examples for org.springframework.jms.listener.adapter.MessageListenerAdapter

The following examples show how to use org.springframework.jms.listener.adapter.MessageListenerAdapter. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: spring-analysis-note   Source File: JmsNamespaceHandlerTests.java    License: MIT License 6 votes vote down vote up
@Test
public void testJcaContainerConfiguration() throws Exception {
	Map<String, JmsMessageEndpointManager> containers = context.getBeansOfType(JmsMessageEndpointManager.class);

	assertTrue("listener3 not found", containers.containsKey("listener3"));
	JmsMessageEndpointManager listener3 = containers.get("listener3");
	assertEquals("Wrong resource adapter",
			context.getBean("testResourceAdapter"), listener3.getResourceAdapter());
	assertEquals("Wrong activation spec factory", context.getBean("testActivationSpecFactory"),
			new DirectFieldAccessor(listener3).getPropertyValue("activationSpecFactory"));


	Object endpointFactory = new DirectFieldAccessor(listener3).getPropertyValue("endpointFactory");
	Object messageListener = new DirectFieldAccessor(endpointFactory).getPropertyValue("messageListener");
	assertEquals("Wrong message listener", MessageListenerAdapter.class, messageListener.getClass());
	MessageListenerAdapter adapter = (MessageListenerAdapter) messageListener;
	DirectFieldAccessor adapterFieldAccessor = new DirectFieldAccessor(adapter);
	assertEquals("Message converter not set properly", context.getBean("testMessageConverter"),
			adapterFieldAccessor.getPropertyValue("messageConverter"));
	assertEquals("Wrong delegate", context.getBean("testBean1"),
			adapterFieldAccessor.getPropertyValue("delegate"));
	assertEquals("Wrong method name", "setName",
			adapterFieldAccessor.getPropertyValue("defaultListenerMethod"));
}
 
Example 2
Source Project: spring-analysis-note   Source File: JmsListenerEndpointTests.java    License: MIT License 6 votes vote down vote up
@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());
}
 
Example 3
Source Project: spring-analysis-note   Source File: JmsListenerEndpointTests.java    License: MIT License 6 votes vote down vote up
@Test
public void setupJcaMessageContainerFullConfig() {
	JmsMessageEndpointManager container = new JmsMessageEndpointManager();
	MessageListener messageListener = new MessageListenerAdapter();
	SimpleJmsListenerEndpoint endpoint = new SimpleJmsListenerEndpoint();
	endpoint.setDestination("myQueue");
	endpoint.setSelector("foo = 'bar'");
	endpoint.setSubscription("mySubscription");
	endpoint.setConcurrency("10");
	endpoint.setMessageListener(messageListener);

	endpoint.setupListenerContainer(container);
	JmsActivationSpecConfig config = container.getActivationSpecConfig();
	assertEquals("myQueue", config.getDestinationName());
	assertEquals("foo = 'bar'", config.getMessageSelector());
	assertEquals("mySubscription", config.getSubscriptionName());
	assertEquals(10, config.getMaxConcurrency());
	assertEquals(messageListener, container.getMessageListener());
}
 
Example 4
@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());
}
 
Example 5
@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());
}
 
Example 6
@Test
public void createJcaContainerFullConfig() {
	DefaultJcaListenerContainerFactory factory = new DefaultJcaListenerContainerFactory();
	setDefaultJcaConfig(factory);
	factory.setConcurrency("10");

	SimpleJmsListenerEndpoint endpoint = new SimpleJmsListenerEndpoint();
	MessageListener messageListener = new MessageListenerAdapter();
	endpoint.setMessageListener(messageListener);
	endpoint.setDestination("myQueue");
	JmsMessageEndpointManager container = factory.createListenerContainer(endpoint);

	assertDefaultJcaConfig(container);
	assertEquals(10, container.getActivationSpecConfig().getMaxConcurrency());
	assertEquals(messageListener, container.getMessageListener());
	assertEquals("myQueue", container.getActivationSpecConfig().getDestinationName());
}
 
Example 7
Source Project: java-technology-stack   Source File: JmsNamespaceHandlerTests.java    License: MIT License 6 votes vote down vote up
@Test
public void testJcaContainerConfiguration() throws Exception {
	Map<String, JmsMessageEndpointManager> containers = context.getBeansOfType(JmsMessageEndpointManager.class);

	assertTrue("listener3 not found", containers.containsKey("listener3"));
	JmsMessageEndpointManager listener3 = containers.get("listener3");
	assertEquals("Wrong resource adapter",
			context.getBean("testResourceAdapter"), listener3.getResourceAdapter());
	assertEquals("Wrong activation spec factory", context.getBean("testActivationSpecFactory"),
			new DirectFieldAccessor(listener3).getPropertyValue("activationSpecFactory"));


	Object endpointFactory = new DirectFieldAccessor(listener3).getPropertyValue("endpointFactory");
	Object messageListener = new DirectFieldAccessor(endpointFactory).getPropertyValue("messageListener");
	assertEquals("Wrong message listener", MessageListenerAdapter.class, messageListener.getClass());
	MessageListenerAdapter adapter = (MessageListenerAdapter) messageListener;
	DirectFieldAccessor adapterFieldAccessor = new DirectFieldAccessor(adapter);
	assertEquals("Message converter not set properly", context.getBean("testMessageConverter"),
			adapterFieldAccessor.getPropertyValue("messageConverter"));
	assertEquals("Wrong delegate", context.getBean("testBean1"),
			adapterFieldAccessor.getPropertyValue("delegate"));
	assertEquals("Wrong method name", "setName",
			adapterFieldAccessor.getPropertyValue("defaultListenerMethod"));
}
 
Example 8
Source Project: java-technology-stack   Source File: JmsListenerEndpointTests.java    License: MIT License 6 votes vote down vote up
@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());
}
 
Example 9
Source Project: java-technology-stack   Source File: JmsListenerEndpointTests.java    License: MIT License 6 votes vote down vote up
@Test
public void setupJcaMessageContainerFullConfig() {
	JmsMessageEndpointManager container = new JmsMessageEndpointManager();
	MessageListener messageListener = new MessageListenerAdapter();
	SimpleJmsListenerEndpoint endpoint = new SimpleJmsListenerEndpoint();
	endpoint.setDestination("myQueue");
	endpoint.setSelector("foo = 'bar'");
	endpoint.setSubscription("mySubscription");
	endpoint.setConcurrency("10");
	endpoint.setMessageListener(messageListener);

	endpoint.setupListenerContainer(container);
	JmsActivationSpecConfig config = container.getActivationSpecConfig();
	assertEquals("myQueue", config.getDestinationName());
	assertEquals("foo = 'bar'", config.getMessageSelector());
	assertEquals("mySubscription", config.getSubscriptionName());
	assertEquals(10, config.getMaxConcurrency());
	assertEquals(messageListener, container.getMessageListener());
}
 
Example 10
@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());
}
 
Example 11
@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());
}
 
Example 12
@Test
public void createJcaContainerFullConfig() {
	DefaultJcaListenerContainerFactory factory = new DefaultJcaListenerContainerFactory();
	setDefaultJcaConfig(factory);
	factory.setConcurrency("10");

	SimpleJmsListenerEndpoint endpoint = new SimpleJmsListenerEndpoint();
	MessageListener messageListener = new MessageListenerAdapter();
	endpoint.setMessageListener(messageListener);
	endpoint.setDestination("myQueue");
	JmsMessageEndpointManager container = factory.createListenerContainer(endpoint);

	assertDefaultJcaConfig(container);
	assertEquals(10, container.getActivationSpecConfig().getMaxConcurrency());
	assertEquals(messageListener, container.getMessageListener());
	assertEquals("myQueue", container.getActivationSpecConfig().getDestinationName());
}
 
Example 13
@Test
public void testJcaContainerConfiguration() throws Exception {
	Map<String, JmsMessageEndpointManager> containers = context.getBeansOfType(JmsMessageEndpointManager.class);

	assertTrue("listener3 not found", containers.containsKey("listener3"));
	JmsMessageEndpointManager listener3 = containers.get("listener3");
	assertEquals("Wrong resource adapter",
			context.getBean("testResourceAdapter"), listener3.getResourceAdapter());
	assertEquals("Wrong activation spec factory", context.getBean("testActivationSpecFactory"),
			new DirectFieldAccessor(listener3).getPropertyValue("activationSpecFactory"));


	Object endpointFactory = new DirectFieldAccessor(listener3).getPropertyValue("endpointFactory");
	Object messageListener = new DirectFieldAccessor(endpointFactory).getPropertyValue("messageListener");
	assertEquals("Wrong message listener", MessageListenerAdapter.class, messageListener.getClass());
	MessageListenerAdapter adapter = (MessageListenerAdapter) messageListener;
	DirectFieldAccessor adapterFieldAccessor = new DirectFieldAccessor(adapter);
	assertEquals("Message converter not set properly", context.getBean("testMessageConverter"),
			adapterFieldAccessor.getPropertyValue("messageConverter"));
	assertEquals("Wrong delegate", context.getBean("testBean1"),
			adapterFieldAccessor.getPropertyValue("delegate"));
	assertEquals("Wrong method name", "setName",
			adapterFieldAccessor.getPropertyValue("defaultListenerMethod"));
}
 
Example 14
@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());
}
 
Example 15
@Test
public void setupJcaMessageContainerFullConfig() {
	JmsMessageEndpointManager container = new JmsMessageEndpointManager();
	MessageListener messageListener = new MessageListenerAdapter();
	SimpleJmsListenerEndpoint endpoint = new SimpleJmsListenerEndpoint();
	endpoint.setDestination("myQueue");
	endpoint.setSelector("foo = 'bar'");
	endpoint.setSubscription("mySubscription");
	endpoint.setConcurrency("10");
	endpoint.setMessageListener(messageListener);

	endpoint.setupListenerContainer(container);
	JmsActivationSpecConfig config = container.getActivationSpecConfig();
	assertEquals("myQueue", config.getDestinationName());
	assertEquals("foo = 'bar'", config.getMessageSelector());
	assertEquals("mySubscription", config.getSubscriptionName());
	assertEquals(10, config.getMaxConcurrency());
	assertEquals(messageListener, container.getMessageListener());
}
 
Example 16
@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());
}
 
Example 17
@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());
}
 
Example 18
@Test
public void createJcaContainerFullConfig() {
	DefaultJcaListenerContainerFactory factory = new DefaultJcaListenerContainerFactory();
	setDefaultJcaConfig(factory);
	factory.setConcurrency("10");

	SimpleJmsListenerEndpoint endpoint = new SimpleJmsListenerEndpoint();
	MessageListener messageListener = new MessageListenerAdapter();
	endpoint.setMessageListener(messageListener);
	endpoint.setDestination("myQueue");
	JmsMessageEndpointManager container = factory.createListenerContainer(endpoint);

	assertDefaultJcaConfig(container);
	assertEquals(10, container.getActivationSpecConfig().getMaxConcurrency());
	assertEquals(messageListener, container.getMessageListener());
	assertEquals("myQueue", container.getActivationSpecConfig().getDestinationName());
}
 
Example 19
Source Project: spring-analysis-note   Source File: JmsListenerEndpointTests.java    License: MIT License 5 votes vote down vote up
@Test
public void setupConcurrencySimpleContainer() {
	SimpleMessageListenerContainer container = new SimpleMessageListenerContainer();
	MessageListener messageListener = new MessageListenerAdapter();
	SimpleJmsListenerEndpoint endpoint = new SimpleJmsListenerEndpoint();
	endpoint.setConcurrency("5-10"); // simple implementation only support max value
	endpoint.setMessageListener(messageListener);

	endpoint.setupListenerContainer(container);
	assertEquals(10, new DirectFieldAccessor(container).getPropertyValue("concurrentConsumers"));
}
 
Example 20
Source Project: spring-analysis-note   Source File: JmsListenerEndpointTests.java    License: MIT License 5 votes vote down vote up
@Test
public void setupMessageContainerUnsupportedContainer() {
	MessageListenerContainer container = mock(MessageListenerContainer.class);
	SimpleJmsListenerEndpoint endpoint = new SimpleJmsListenerEndpoint();
	endpoint.setMessageListener(new MessageListenerAdapter());

	assertThatIllegalArgumentException().isThrownBy(() ->
			endpoint.setupListenerContainer(container));
}
 
Example 21
@Test
public void createListener() {
	SimpleJmsListenerEndpoint endpoint = new SimpleJmsListenerEndpoint();
	MessageListener messageListener = new MessageListenerAdapter();
	endpoint.setMessageListener(messageListener);
	assertSame(messageListener, endpoint.createMessageListener(container));
}
 
Example 22
@Test
public void jcaExclusiveProperties() {
	DefaultJcaListenerContainerFactory factory = new DefaultJcaListenerContainerFactory();
	factory.setDestinationResolver(this.destinationResolver);
	factory.setActivationSpecFactory(new StubJmsActivationSpecFactory());

	SimpleJmsListenerEndpoint endpoint = new SimpleJmsListenerEndpoint();
	endpoint.setMessageListener(new MessageListenerAdapter());
	assertThatIllegalStateException().isThrownBy(() ->
			factory.createListenerContainer(endpoint));
}
 
Example 23
@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"));
}
 
Example 24
@Test
public void endpointConcurrencyTakesPrecedence() {
	DefaultJmsListenerContainerFactory factory = new DefaultJmsListenerContainerFactory();
	factory.setConcurrency("2-10");

	SimpleJmsListenerEndpoint endpoint = new SimpleJmsListenerEndpoint();
	MessageListener messageListener = new MessageListenerAdapter();
	endpoint.setMessageListener(messageListener);
	endpoint.setDestination("myQueue");
	endpoint.setConcurrency("4-6");
	DefaultMessageListenerContainer container = factory.createListenerContainer(endpoint);
	assertEquals(4, container.getConcurrentConsumers());
	assertEquals(6, container.getMaxConcurrentConsumers());
}
 
Example 25
Source Project: java-technology-stack   Source File: JmsListenerEndpointTests.java    License: MIT License 5 votes vote down vote up
@Test
public void setupConcurrencySimpleContainer() {
	SimpleMessageListenerContainer container = new SimpleMessageListenerContainer();
	MessageListener messageListener = new MessageListenerAdapter();
	SimpleJmsListenerEndpoint endpoint = new SimpleJmsListenerEndpoint();
	endpoint.setConcurrency("5-10"); // simple implementation only support max value
	endpoint.setMessageListener(messageListener);

	endpoint.setupListenerContainer(container);
	assertEquals(10, new DirectFieldAccessor(container).getPropertyValue("concurrentConsumers"));
}
 
Example 26
Source Project: java-technology-stack   Source File: JmsListenerEndpointTests.java    License: MIT License 5 votes vote down vote up
@Test
public void setupMessageContainerUnsupportedContainer() {
	MessageListenerContainer container = mock(MessageListenerContainer.class);
	SimpleJmsListenerEndpoint endpoint = new SimpleJmsListenerEndpoint();
	endpoint.setMessageListener(new MessageListenerAdapter());

	thrown.expect(IllegalArgumentException.class);
	endpoint.setupListenerContainer(container);
}
 
Example 27
@Test
public void createListener() {
	SimpleJmsListenerEndpoint endpoint = new SimpleJmsListenerEndpoint();
	MessageListener messageListener = new MessageListenerAdapter();
	endpoint.setMessageListener(messageListener);
	assertSame(messageListener, endpoint.createMessageListener(container));
}
 
Example 28
@Test
public void jcaExclusiveProperties() {
	DefaultJcaListenerContainerFactory factory = new DefaultJcaListenerContainerFactory();
	factory.setDestinationResolver(this.destinationResolver);
	factory.setActivationSpecFactory(new StubJmsActivationSpecFactory());

	SimpleJmsListenerEndpoint endpoint = new SimpleJmsListenerEndpoint();
	endpoint.setMessageListener(new MessageListenerAdapter());
	this.thrown.expect(IllegalStateException.class);
	factory.createListenerContainer(endpoint);
}
 
Example 29
@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"));
}
 
Example 30
@Test
public void endpointConcurrencyTakesPrecedence() {
	DefaultJmsListenerContainerFactory factory = new DefaultJmsListenerContainerFactory();
	factory.setConcurrency("2-10");

	SimpleJmsListenerEndpoint endpoint = new SimpleJmsListenerEndpoint();
	MessageListener messageListener = new MessageListenerAdapter();
	endpoint.setMessageListener(messageListener);
	endpoint.setDestination("myQueue");
	endpoint.setConcurrency("4-6");
	DefaultMessageListenerContainer container = factory.createListenerContainer(endpoint);
	assertEquals(4, container.getConcurrentConsumers());
	assertEquals(6, container.getMaxConcurrentConsumers());
}