camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From agentalpha <yogesh.l...@gmail.com>
Subject activemq jms topic route with durable subscriber
Date Tue, 06 Jan 2015 14:45:36 GMT
Hi,

I have following route which reads the messages from topic and processes it.
  <route id="refreshRepoRoute">
<from
uri="activemq:topic:com.mycompany.RefreshTopic?clientId=consumerOneId&amp;durableSubscriptionName=ConsumerOneName&amp;connectionFactory=durableTopicPooledConnectionFactory"
/>
<process ref="repositoryRefreshProcessor" />
</route>

And configuration for connectionFactory is as follows:
<bean id="durableTopicJmsConnectionFactory"
class="org.apache.activemq.ActiveMQConnectionFactory">
		<property name="brokerURL"
value="vm://localbroker?jms.prefetchPolicy.topicPrefetch=0" />
		<property name="useAsyncSend" value="true" />
	</bean>
	
	<bean id="durableTopicPooledConnectionFactory"
class="org.apache.activemq.pool.PooledConnectionFactory"
		init-method="start" destroy-method="stop">
		<property name="maxConnections" value="1" />
		<property name="connectionFactory" ref="durableTopicJmsConnectionFactory"
/>
	</bean>

The idea is that as soon as a message is published on the topic, the route
will process it using the durable subscriber.

But we are facing a problem in this configuration:
>From 2nd message onwards, since the durable consumer is already created,
while attempting to read the message, the route tries to create a new
durable consumer with same name and id and hence it fails for durable
consumer already in use:
2015-01-06 18:03:25,090 | WARN  | .RefreshTopic] |
faultJmsMessageListenerContainer | 180 -
org.apache.servicemix.bundles.spring-jms - 3.2.11.RELEASE_1 | Setup of JMS
message listener invoker failed for destination 'com.mycompany.RefreshTopic'
- trying to recover. Cause: Durable consumer is in use for client:
consumerOneId and subscriptionName: ConsumerOneName.

After this it gives error regarding Consumer is closed for a while:
Setup of JMS message listener invoker failed for destination
'com.mycompany.RefreshTopic' - trying to recover. Cause: The Consumer is
closed.
At this stage, the route is still able to process the message successfully
to repositoryRefreshProcessor.

This error happens a few times (5 or 6) and then we start getting session is
closed error:
Setup of JMS message listener invoker failed for destination
'com.mycompany.RefreshTopic' - trying to recover. Cause: The Session is
closed.
After this, the route stops processing the message and they are not picked
up by the durable consumer at all till the system is restarted.

Please advice as what is the correct approach to handle/implement such
route.
I took reference of this example from camel:
http://camel.apache.org/durable-subscriber.html

Thanks.

Yogesh





--
View this message in context: http://camel.465427.n5.nabble.com/activemq-jms-topic-route-with-durable-subscriber-tp5761386.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Mime
View raw message