Announcement Announcement Module
Collapse
No announcement yet.
Message Driven POJO/JBoss 7.1.1/JBossWorkManagerTaskExecutor Configuration Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Message Driven POJO/JBoss 7.1.1/JBossWorkManagerTaskExecutor Configuration

    Hi All:

    I have setup a Spring (version 3.2.0) Message Driven POJO (MDP) inside JBoss (7.1.1.Final) as below.

    Code:
            <jee:jndi-lookup id="connectionFactory" jndi-name="java:/JmsXA"
    		lookup-on-startup="true" /> <!-- proxy-interface="javax.jms.ConnectionFactory" -->
    
    	<jee:jndi-lookup id="testQueue" jndi-name="java:/queue/test"
    		lookup-on-startup="true" /> <!-- proxy-interface="javax.jms.Queue" -->
    
    	<!-- this is the Message Driven POJO (MDP) -->
    	<bean id="messageListener" class="com.mobile.mdb.RealTimeQuoteServiceMDB">
    		<property name="realTimeQuoteService" ref="quoteServiceBean" />
    		<property name="stockQuoteCache" ref="stockQuoteCache" />
    		<property name="stockQuoteDAO" ref="stockQuoteDAO" />
    	</bean>
    
    	<!-- and this is the message listener container -->
    	<bean id="jmsContainer"
    		class="org.springframework.jms.listener.DefaultMessageListenerContainer">
    		<property name="connectionFactory" ref="connectionFactory" />
    		<property name="destination" ref="testQueue" />
    		<property name="messageListener" ref="messageListener" />
    	</bean>
    This is working. The problem is, this setup has no concurrency. So for example, if I drop 10 messages on the queue, only one MDP will service all 10 messages, one after the other. Reading the documentation, if I add this
    Code:
    <property name="concurrentConsumers" value="10"/>
    to the "jmsContainer" bean above, I should see 10 concurrent MDPs available for execution at any time. In practice, I see the below startup execption in JBoss logs

    Code:
    18:04:46,172 ERROR [org.hornetq.ra.HornetQRASessionFactoryImpl] (jmsContainer-2) Could not create session: javax.jms.IllegalStateException: Only allowed one session per connection. See the J2EE spec, e.g. J2EE1.4 Section 6.6
    	at org.hornetq.ra.HornetQRASessionFactoryImpl.allocateConnection(HornetQRASessionFactoryImpl.java:816)
    	at org.hornetq.ra.HornetQRASessionFactoryImpl.createSession(HornetQRASessionFactoryImpl.java:470)
    	at org.springframework.jms.support.JmsAccessor.createSession(JmsAccessor.java:196) [spring-jms-3.2.0.RELEASE.jar:3.2.0.RELEASE]
    	at org.springframework.jms.listener.DefaultMessageListenerContainer.access$1400(DefaultMessageListenerContainer.java:112) [spring-jms-3.2.0.RELEASE.jar:3.2.0.RELEASE]
    	at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.initResourcesIfNecessary(DefaultMessageListenerContainer.java:1089) [spring-jms-3.2.0.RELEASE.jar:3.2.0.RELEASE]
    	at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.invokeListener(DefaultMessageListenerContainer.java:1068) [spring-jms-3.2.0.RELEASE.jar:3.2.0.RELEASE]
    	at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.executeOngoingLoop(DefaultMessageListenerContainer.java:1061) [spring-jms-3.2.0.RELEASE.jar:3.2.0.RELEASE]
    	at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.run(DefaultMessageListenerContainer.java:958) [spring-jms-3.2.0.RELEASE.jar:3.2.0.RELEASE]
    	at java.lang.Thread.run(Thread.java:662) [rt.jar:1.6.0_26]
    Reading the documentation, it sounds like I need to setup a JBossWorkManagerTaskExecutor to achieve the concurrency. But I am not able to find any examples on how to set this up. So asking the gurus here, any help/pointers will be very appreciated.

    Thanks in advance!
Working...
X