Announcement Announcement Module
Collapse
No announcement yet.
MDP concurrent consumers Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • MDP concurrent consumers

    I have MDP listener container defined with concurrent consumers listening to the same queue.
    Each consumer takes longer time for processing the message. The problem I am facing now is that sometimes one message in the middle of processing is being picked up by another consumer. The message is getting removed from the queue only
    when the MDP commits transaction which is fine. But at the same time the other consumer should not pick up
    the message that is being processed by another thread just because transaction is not committed.
    The message needs to be locked to a single consumer while processing.

    Is there any way I can handle this through configuration of Spring or Activemq?

    I am using Spring 2.5.6 and ActiveMQ 5.2.
    Code:
    <bean id="transactionManager"
    		class="org.springframework.jms.connection.JmsTransactionManager">
    		<property name="connectionFactory">
    			<ref bean="connectionFactory" />
    		</property>
    	</bean>
    
    <jms:listener-container connection-factory="connectionFactory"
    		message-converter="messageConverter" transaction-manager="transactionManager"
    		concurrency="5" >
    	<jms:listener destination="prod.queue" ref="prodListener" method="processProducts" />
    </jms:listener-container>

  • #2
    Multiple consumers should not be receiving the same message from a queue.
    If it is not happening this way, you have something misconfigured--likely in ActiveMQ.

    Comment


    • #3
      Ahh, you may want to look at these:

      http://issues.apache.org/activemq/browse/AMQ-1936
      http://www.nabble.com/duplicate-mess...d20889152.html

      There was a bug in 5.1/5.2 that caused duplicate messages to be delivered to multiple consumers. I'd suggest that you upgrade ActiveMQ to >=5.3 and test again.

      Comment


      • #4
        Originally posted by chudak View Post
        Ahh, you may want to look at these:

        http://issues.apache.org/activemq/browse/AMQ-1936
        http://www.nabble.com/duplicate-mess...d20889152.html

        There was a bug in 5.1/5.2 that caused duplicate messages to be delivered to multiple consumers. I'd suggest that you upgrade ActiveMQ to >=5.3 and test again.
        Thanks a lot. Yes I have upgraded to ActiveMQ 5.3 and tried the same program and found it is resolved. Once again thanks for great help.

        Comment

        Working...
        X