camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dimitry Pletnikov <dimi...@pletnikov.com>
Subject Understanding ActiveMQ consumer with concurrentConsumers
Date Wed, 11 Dec 2013 04:58:26 GMT
Using:
- ServiceMix 4.3.5
- ActiveMQ 5.7.0
- Camel 2.10.7

I have a persistent queue in ActiveMQ, which I consume messages from
using activemq-component with concurrentConsumers=20 set.

ActiveMQ connections are pooled:

    <bean id="activemqConnectionFactory"
class="org.apache.activemq.ActiveMQConnectionFactory"
depends-on="broker">

        <property name="brokerURL"
value="vm://${activemq.brokername}?create=false&amp;waitForStart=10000"
/>
        <property name="userName" value="${activemq.user}"/>
        <property name="password" value="${activemq.password}"/>
    </bean>

    <bean id="pooledConnectionFactory"
class="org.apache.activemq.pool.PooledConnectionFactory">
        <property name="idleTimeout" value="0" />
        <property name="maxConnections" value="8" />
        <property name="connectionFactory" ref="activemqConnectionFactory" />
    </bean>

    <bean id="resourceManager"
class="org.apache.activemq.pool.ActiveMQResourceManager"
init-method="recoverResource">
        <property name="transactionManager" ref="recoverableTxManager" />
        <property name="connectionFactory" ref="activemqConnectionFactory" />
        <property name="resourceName" value="activemq.${name}" />
    </bean>

    <reference id="recoverableTxManager"
interface="org.apache.geronimo.transaction.manager.RecoverableTransactionManager"
availability="mandatory" />

I have a route looking like:

<from uri="activemq://item_updates?concurrentConsumers=20" />
<delay><constant>5000</constant></delay>
<log message="item ${header.item_id}" />

I expect to see something like:
  item 1
  item 2
  item 3
  item 4
  item 5
  <5 seconds pause>
  item 6
  item 7
  ..etc

Instead the output looks like:
  item 1
  <5 seconds pause>
 item 2
 <5 seconds pause>
 ..etc

My guesses are:
- all messages are being prefetched by the first concurrent consumer?
-or-
- it has something to do with pooled ActiveMQ connections?
-or-
- ???

Looking at examples and documentation it should be simple and easy. In
my case it's not.

Mime
View raw message