Search in sources :

Example 6 with JmsMessageEndpointManager

use of org.springframework.jms.listener.endpoint.JmsMessageEndpointManager 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());
}
Also used : DefaultMessageListenerContainer(org.springframework.jms.listener.DefaultMessageListenerContainer) JmsMessageEndpointManager(org.springframework.jms.listener.endpoint.JmsMessageEndpointManager) Test(org.junit.Test)

Example 7 with JmsMessageEndpointManager

use of org.springframework.jms.listener.endpoint.JmsMessageEndpointManager 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());
}
Also used : DefaultMessageListenerContainer(org.springframework.jms.listener.DefaultMessageListenerContainer) JmsMessageEndpointManager(org.springframework.jms.listener.endpoint.JmsMessageEndpointManager) Test(org.junit.Test)

Aggregations

JmsMessageEndpointManager (org.springframework.jms.listener.endpoint.JmsMessageEndpointManager)7 Test (org.junit.Test)6 MessageListenerAdapter (org.springframework.jms.listener.adapter.MessageListenerAdapter)3 MessageListener (javax.jms.MessageListener)2 DefaultMessageListenerContainer (org.springframework.jms.listener.DefaultMessageListenerContainer)2 DirectFieldAccessor (org.springframework.beans.DirectFieldAccessor)1 JmsActivationSpecConfig (org.springframework.jms.listener.endpoint.JmsActivationSpecConfig)1