You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by nqbeel <a....@gmail.com> on 2014/04/15 00:24:41 UTC

Camel transaction handler forces reconnecting to ActiveMQ

Trying to set up a route with transaction handling on a camel, this leads to
connection to the activeMQ drop and reconnect every few milliseconds is this
expected, is there a work around?

Logs showing repeatedly reconnecting to ActiveMQ server:

ActiveMQ FailoverTransport Successfully connected to
ssl://serveraddress:61617
ActiveMQ FailoverTransport Successfully connected to
ssl://serveraddress:61617
ActiveMQ FailoverTransport Successfully connected to
ssl://serveraddress:61617



--
View this message in context: http://camel.465427.n5.nabble.com/Camel-transaction-handler-forces-reconnecting-to-ActiveMQ-tp5750224.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Camel transaction handler forces reconnecting to ActiveMQ

Posted by Claus Ibsen <cl...@gmail.com>.
Hi

See this page about using connection pooling
http://camel.apache.org/activemq

On Tue, Apr 15, 2014 at 10:25 PM, nqbeel <a....@gmail.com> wrote:
> Also I did see that when I remove failover from the Broker URL it seems to be
> working fine.
>
> Currently its set to
> broker.url=failover:(ssl://server:61617)?maxReconnectDelay=60000
>
> Is there anything that needs to be changed to accommodate failover?
>
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Camel-transaction-handler-forces-reconnecting-to-ActiveMQ-tp5750224p5750267.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
Red Hat, Inc.
Email: cibsen@redhat.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen
hawtio: http://hawt.io/
fabric8: http://fabric8.io/

Re: Camel transaction handler forces reconnecting to ActiveMQ

Posted by nqbeel <a....@gmail.com>.
Also I did see that when I remove failover from the Broker URL it seems to be
working fine.

Currently its set to 
broker.url=failover:(ssl://server:61617)?maxReconnectDelay=60000

Is there anything that needs to be changed to accommodate failover?




--
View this message in context: http://camel.465427.n5.nabble.com/Camel-transaction-handler-forces-reconnecting-to-ActiveMQ-tp5750224p5750267.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Camel transaction handler forces reconnecting to ActiveMQ

Posted by nqbeel <a....@gmail.com>.
Yes, I do have cache level set to CACHE_CONSUMER as recommended.       

Below is my spring configuration,

        <bean id="jms"
class="org.apache.activemq.camel.component.ActiveMQComponent">                
                <property name="configuration" ref="activeMQConfig"/>	  		
  		<property name="transacted" value="true"/>
  		<property name="transactionManager" ref="jmsTxManager"/>
        </bean>

	<bean id="activeMQConfig"
		class="org.apache.activemq.camel.component.ActiveMQConfiguration">
		<property name="connectionFactory" ref="conFactory" />
		<property name="cacheLevelName" value="CACHE_CONSUMER" />
		<property name="concurrentConsumers" value="10" />		
	</bean>
	
	<bean id="conFactory"
class="org.apache.activemq.ActiveMQConnectionFactory">
		<property name="brokerURL" value="${activemq.broker.url}" />
		<property name="userName" value="${userName}" />
		<property name="password" value="${password}" />
		<property name="watchTopicAdvisories" value="false" />
	</bean>
	
	<bean id="jmsTxManager"
class="org.springframework.jms.connection.JmsTransactionManager">
		<property name="connectionFactory" ref="conFactory" />
	</bean>


Claus Ibsen-2 wrote
> On Mon, Apr 14, 2014 at 3:24 PM, nqbeel &lt;

> a.nabeelahamed@

> &gt; wrote:
>> Trying to set up a route with transaction handling on a camel, this leads
>> to
>> connection to the activeMQ drop and reconnect every few milliseconds is
>> this
>> expected, is there a work around?
>>
> 
> Do you use caching as recommended here, eg see that 2nd box on the top
> of the page
> http://camel.apache.org/jms
> 
> 
>> Logs showing repeatedly reconnecting to ActiveMQ server:
>>
>> ActiveMQ FailoverTransport Successfully connected to
>> ssl://serveraddress:61617
>> ActiveMQ FailoverTransport Successfully connected to
>> ssl://serveraddress:61617
>> ActiveMQ FailoverTransport Successfully connected to
>> ssl://serveraddress:61617
>>
>>
>>
>> --
>> View this message in context:
>> http://camel.465427.n5.nabble.com/Camel-transaction-handler-forces-reconnecting-to-ActiveMQ-tp5750224.html
>> Sent from the Camel - Users mailing list archive at Nabble.com.
> 
> 
> 
> -- 
> Claus Ibsen
> -----------------
> Red Hat, Inc.
> Email: 

> cibsen@

> Twitter: davsclaus
> Blog: http://davsclaus.com
> Author of Camel in Action: http://www.manning.com/ibsen
> hawtio: http://hawt.io/
> fabric8: http://fabric8.io/





--
View this message in context: http://camel.465427.n5.nabble.com/Camel-transaction-handler-forces-reconnecting-to-ActiveMQ-tp5750224p5750261.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Camel transaction handler forces reconnecting to ActiveMQ

Posted by "kraythe ." <kr...@gmail.com>.
Interestingly i found something similar but using Atomikos JTA in a test
environment. My logs show the creation and commit of transactions
constantly (see below) but that wasn't a high priority because it was a
test environment. It especially occurs if a test has to wait a while for
the mocks to be satisfied. However if there is something inside camel
causing this in production, that is another matter.

09:12:06,350 INFO  [Tracer] ID-rsimmonsjr-mbp-58071-1397571125528-0-12 >>>
(TestRoute)
marshal[org.apache.camel.component.jackson.JacksonDataFormat@70256760] -->
activemq://queue:outbox <<< Pattern:InOnly,
Headers:{breadcrumbId=ID-rsimmonsjr-mbp-58071-1397571125528-0-1,
JMSCorrelationID=null, JMSXGroupID=null, JMSReplyTo=null,
JMSDestination=queue://inbox, JMSPriority=4, JMSTimestamp=1397571126253,
JMSType=null, JMSRedelivered=false,
CamelInterceptedEndpoint=activemq://queue:inbox, JMSXUserID=null,
JMSDeliveryMode=2,
JMSMessageID=ID:rsimmonsjr-mbp-58070-1397571125204-3:5:2:3:1,
JMSExpiration=0}, BodyType:byte[],
Body:{"case_date":"2013-11-06T08:03:08.000+0000","case_id":"5000NQLj8N9J11"}

After this the test case has to wait. (To mock it I set it to expect more
messages then it will ever get.)

09:12:06,352 INFO  [CompositeTransactionImp] registerSynchronization (
com.atomikos.jms.ConsumerProducerSupport$JmsRequeueSynchronization@80553152)
for transaction 20140415-091204_AtomikosTxnMgr0001200001
09:12:06,353 INFO  [CompositeTransactionImp] addParticipant (
XAResourceTransaction:
32303134303431352D3039313230345F41746F6D696B6F7354786E4D677230303031323030303031:32303134303431352D3039313230345F41746F6D696B6F7354786E4D67723132
) for transaction 20140415-091204_AtomikosTxnMgr0001200001
09:12:06,353 INFO  [XAResourceTransaction] XAResource.start (
32303134303431352D3039313230345F41746F6D696B6F7354786E4D677230303031323030303031:32303134303431352D3039313230345F41746F6D696B6F7354786E4D67723132
, XAResource.TMNOFLAGS ) on resource amq-embedded represented by XAResource
instance TransactionContext{transactionId=null}
09:12:06,353 INFO  [Tracer] ID-rsimmonsjr-mbp-58071-1397571125528-0-12 >>>
(TestRoute) activemq://queue:outbox -->
unmarshal[org.apache.camel.component.jackson.JacksonDataFormat@70256760]
<<< Pattern:InOnly, Headers:{JMSCorrelationID=null, JMSRedelivered=false,
JMSMessageID=ID:rsimmonsjr-mbp-58070-1397571125204-3:5:2:3:1,
JMSDeliveryMode=2, JMSPriority=4, JMSXGroupID=null,
breadcrumbId=ID-rsimmonsjr-mbp-58071-1397571125528-0-1,
JMSTimestamp=1397571126253, JMSType=null, JMSXUserID=null,
JMSDestination=queue://inbox,
CamelInterceptedEndpoint=activemq://queue:outbox, JMSExpiration=0,
JMSReplyTo=null}, BodyType:byte[],
Body:{"case_date":"2013-11-06T08:03:08.000+0000","case_id":"5000NQLj8N9J11"}
09:12:06,354 INFO  [Tracer] ID-rsimmonsjr-mbp-58071-1397571125528-0-12 >>>
(TestRoute)
unmarshal[org.apache.camel.component.jackson.JacksonDataFormat@70256760]
--> mock://after_to_queue <<< Pattern:InOnly, Headers:{JMSExpiration=0,
JMSTimestamp=1397571126253, JMSCorrelationID=null,
JMSDestination=queue://inbox, JMSReplyTo=null,
CamelInterceptedEndpoint=activemq://queue:outbox,
JMSMessageID=ID:rsimmonsjr-mbp-58070-1397571125204-3:5:2:3:1,
JMSXGroupID=null, JMSXUserID=null,
breadcrumbId=ID-rsimmonsjr-mbp-58071-1397571125528-0-1, JMSDeliveryMode=2,
JMSType=null, JMSRedelivered=false, JMSPriority=4},
BodyType:com.ea.wwce.camel.test.utilities.TransactionTestTools.CaseRecord,
Body:{case_date=2013-11-06 02:03:08.0, case_id=5000NQLj8N9J11}
09:12:06,354 INFO  [XAResourceTransaction] XAResource.end (
32303134303431352D3039313230345F41746F6D696B6F7354786E4D677230303031323030303031:32303134303431352D3039313230345F41746F6D696B6F7354786E4D67723132
, XAResource.TMSUCCESS ) on resource amq-embedded represented by XAResource
instance
TransactionContext{transactionId=XID:[1096044365,globalId=32303134303431352d3039313230345f41746f6d696b6f7354786e4d677230303031323030303031,branchId=32303134303431352d3039313230345f41746f6d696b6f7354786e4d67723132]}
09:12:06,354 INFO  [CompositeTransactionImp] commit() done (by application)
of transaction 20140415-091204_AtomikosTxnMgr0001200001
09:12:06,355 INFO  [XAResourceTransaction] XAResource.commit (
32303134303431352D3039313230345F41746F6D696B6F7354786E4D677230303031323030303031:32303134303431352D3039313230345F41746F6D696B6F7354786E4D67723132
, true ) on resource amq-embedded represented by XAResource instance
TransactionContext{transactionId=null}
09:12:06,355 INFO  [BaseTransactionManager] resume (
com.atomikos.icatch.imp.CompositeTransactionImp@7ceb8014 ) done for
transaction 20140415-091204_AtomikosTxnMgr0001000001
09:12:06,356 INFO  [XAResourceTransaction] XAResource.end (
32303134303431352D3039313230345F41746F6D696B6F7354786E4D677230303031303030303031:32303134303431352D3039313230345F41746F6D696B6F7354786E4D67723130
, XAResource.TMSUCCESS ) on resource amq-embedded represented by XAResource
instance
TransactionContext{transactionId=XID:[1096044365,globalId=32303134303431352d3039313230345f41746f6d696b6f7354786e4d677230303031303030303031,branchId=32303134303431352d3039313230345f41746f6d696b6f7354786e4d67723130]}
09:12:06,356 INFO  [Tracer] ID-rsimmonsjr-mbp-58071-1397571125528-0-13 >>>
(ResultsRoute) from(activemq://queue:outbox) -->
transacted[ref:java:app/activemq/txnManager/policy/REQUIRED] <<<
Pattern:InOnly, Headers:{CamelJmsDeliveryMode=2, JMSReplyTo=null,
JMSDestination=queue://outbox, JMSType=null, JMSTimestamp=1397571126353,
breadcrumbId=ID-rsimmonsjr-mbp-58071-1397571125528-0-1, JMSXGroupID=null,
JMSPriority=4, JMSCorrelationID=null, JMSDeliveryMode=2,
JMSRedelivered=false, JMSExpiration=0, JMSXUserID=null,
CamelInterceptedEndpoint=activemq://queue:outbox,
JMSMessageID=ID:rsimmonsjr-mbp-58070-1397571125204-3:5:8:1:1},
BodyType:byte[],
Body:{"case_date":"2013-11-06T08:03:08.000+0000","case_id":"5000NQLj8N9J11"}
09:12:06,356 INFO  [CompositeTransactionImp] commit() done (by application)
of transaction 20140415-091204_AtomikosTxnMgr0001000001
09:12:06,356 INFO  [Tracer] ID-rsimmonsjr-mbp-58071-1397571125528-0-13 >>>
(ResultsRoute) transacted[ref:java:app/activemq/txnManager/policy/REQUIRED]
--> unmarshal[org.apache.camel.component.jackson.JacksonDataFormat@70256760]
<<< Pattern:InOnly, Headers:{CamelJmsDeliveryMode=2, JMSReplyTo=null,
JMSDestination=queue://outbox, JMSType=null, JMSTimestamp=1397571126353,
breadcrumbId=ID-rsimmonsjr-mbp-58071-1397571125528-0-1, JMSXGroupID=null,
JMSPriority=4, JMSCorrelationID=null, JMSDeliveryMode=2,
JMSRedelivered=false, JMSExpiration=0, JMSXUserID=null,
CamelInterceptedEndpoint=activemq://queue:outbox,
JMSMessageID=ID:rsimmonsjr-mbp-58070-1397571125204-3:5:8:1:1},
BodyType:byte[],
Body:{"case_date":"2013-11-06T08:03:08.000+0000","case_id":"5000NQLj8N9J11"}
09:12:06,356 INFO  [XAResourceTransaction] XAResource.commit (
32303134303431352D3039313230345F41746F6D696B6F7354786E4D677230303031303030303031:32303134303431352D3039313230345F41746F6D696B6F7354786E4D67723130
, true ) on resource amq-embedded represented by XAResource instance
TransactionContext{transactionId=null}
09:12:06,357 INFO  [Tracer] ID-rsimmonsjr-mbp-58071-1397571125528-0-13 >>>
(ResultsRoute)
unmarshal[org.apache.camel.component.jackson.JacksonDataFormat@70256760]
--> mock://end <<< Pattern:InOnly, Headers:{CamelJmsDeliveryMode=2,
CamelInterceptedEndpoint=activemq://queue:outbox, JMSPriority=4,
JMSReplyTo=null,
JMSMessageID=ID:rsimmonsjr-mbp-58070-1397571125204-3:5:8:1:1, JMSType=null,
JMSTimestamp=1397571126353, JMSXGroupID=null, JMSRedelivered=false,
JMSDestination=queue://outbox, JMSDeliveryMode=2,
breadcrumbId=ID-rsimmonsjr-mbp-58071-1397571125528-0-1,
JMSCorrelationID=null, JMSExpiration=0, JMSXUserID=null},
BodyType:com.ea.wwce.camel.test.utilities.TransactionTestTools.CaseRecord,
Body:{case_date=2013-11-06 02:03:08.0, case_id=5000NQLj8N9J11}
09:12:06,357 INFO  [XAResourceTransaction] XAResource.end (
32303134303431352D3039313230345F41746F6D696B6F7354786E4D677230303031313030303031:32303134303431352D3039313230345F41746F6D696B6F7354786E4D67723131
, XAResource.TMSUCCESS ) on resource amq-embedded represented by XAResource
instance
TransactionContext{transactionId=XID:[1096044365,globalId=32303134303431352d3039313230345f41746f6d696b6f7354786e4d677230303031313030303031,branchId=32303134303431352d3039313230345f41746f6d696b6f7354786e4d67723131]}
09:12:06,357 INFO  [BaseTransactionManager] createCompositeTransaction (
10000 ): created new ROOT transaction with id
20140415-091204_AtomikosTxnMgr0001300001
09:12:06,357 INFO  [CompositeTransactionImp] commit() done (by application)
of transaction 20140415-091204_AtomikosTxnMgr0001100001
09:12:06,358 INFO  [XAResourceTransaction] XAResource.commit (
32303134303431352D3039313230345F41746F6D696B6F7354786E4D677230303031313030303031:32303134303431352D3039313230345F41746F6D696B6F7354786E4D67723131
, true ) on resource amq-embedded represented by XAResource instance
TransactionContext{transactionId=null}
09:12:06,358 INFO  [BaseTransactionManager] createCompositeTransaction (
10000 ): created new ROOT transaction with id
20140415-091204_AtomikosTxnMgr0001400001
09:12:06,360 INFO  [CompositeTransactionImp] registerSynchronization (
com.atomikos.jms.ConsumerProducerSupport$JmsRequeueSynchronization@820a09f1)
for transaction 20140415-091204_AtomikosTxnMgr0001300001
09:12:06,360 INFO  [CompositeTransactionImp] addParticipant (
XAResourceTransaction:
32303134303431352D3039313230345F41746F6D696B6F7354786E4D677230303031333030303031:32303134303431352D3039313230345F41746F6D696B6F7354786E4D67723133
) for transaction 20140415-091204_AtomikosTxnMgr0001300001
09:12:06,360 INFO  [XAResourceTransaction] XAResource.start (
32303134303431352D3039313230345F41746F6D696B6F7354786E4D677230303031333030303031:32303134303431352D3039313230345F41746F6D696B6F7354786E4D67723133
, XAResource.TMNOFLAGS ) on resource amq-embedded represented by XAResource
instance TransactionContext{transactionId=null}
09:12:06,360 INFO  [CompositeTransactionImp] registerSynchronization (
com.atomikos.jms.ConsumerProducerSupport$JmsRequeueSynchronization@83bee290)
for transaction 20140415-091204_AtomikosTxnMgr0001400001
09:12:06,361 INFO  [CompositeTransactionImp] addParticipant (
XAResourceTransaction:
32303134303431352D3039313230345F41746F6D696B6F7354786E4D677230303031343030303031:32303134303431352D3039313230345F41746F6D696B6F7354786E4D67723134
) for transaction 20140415-091204_AtomikosTxnMgr0001400001
09:12:06,361 INFO  [XAResourceTransaction] XAResource.start (
32303134303431352D3039313230345F41746F6D696B6F7354786E4D677230303031343030303031:32303134303431352D3039313230345F41746F6D696B6F7354786E4D67723134
, XAResource.TMNOFLAGS ) on resource amq-embedded represented by XAResource
instance TransactionContext{transactionId=null}
09:12:07,336 INFO  [XAResourceTransaction] XAResource.end (
32303134303431352D3039313230345F41746F6D696B6F7354786E4D677230303030363030303031:32303134303431352D3039313230345F41746F6D696B6F7354786E4D677238
, XAResource.TMSUCCESS ) on resource amq-embedded represented by XAResource
instance
TransactionContext{transactionId=XID:[1096044365,globalId=32303134303431352d3039313230345f41746f6d696b6f7354786e4d677230303030363030303031,branchId=32303134303431352d3039313230345f41746f6d696b6f7354786e4d677238]}
09:12:07,337 INFO  [CompositeTransactionImp] commit() done (by application)
of transaction 20140415-091204_AtomikosTxnMgr0000600001

And on it goes until the timeout hits on the test and it is shut down. I
guess my concern is why it should be creating transactions for doing
nothing but waiting. Perhaps it is creating a new transaction per poll
which seems a bit excessive. I would think it would be better to create the
transaction only when a new message arrives and a poll is successful. i.e.
check if there are messages --> if yes then create transaction and fetch
message.

However with JTA you cant use caching so if you have composite resources
involved in the route, the constant connection spam is unavoidable.

*Robert Simmons Jr. MSc. - Lead Java Architect @ EA*
*Author of: Hardcore Java (2003) and Maintainable Java (2012)*
*LinkedIn: **http://www.linkedin.com/pub/robert-simmons/40/852/a39
<http://www.linkedin.com/pub/robert-simmons/40/852/a39>*


On Tue, Apr 15, 2014 at 8:01 AM, Claus Ibsen <cl...@gmail.com> wrote:

> On Mon, Apr 14, 2014 at 3:24 PM, nqbeel <a....@gmail.com> wrote:
> > Trying to set up a route with transaction handling on a camel, this
> leads to
> > connection to the activeMQ drop and reconnect every few milliseconds is
> this
> > expected, is there a work around?
> >
>
> Do you use caching as recommended here, eg see that 2nd box on the top
> of the page
> http://camel.apache.org/jms
>
>
> > Logs showing repeatedly reconnecting to ActiveMQ server:
> >
> > ActiveMQ FailoverTransport Successfully connected to
> > ssl://serveraddress:61617
> > ActiveMQ FailoverTransport Successfully connected to
> > ssl://serveraddress:61617
> > ActiveMQ FailoverTransport Successfully connected to
> > ssl://serveraddress:61617
> >
> >
> >
> > --
> > View this message in context:
> http://camel.465427.n5.nabble.com/Camel-transaction-handler-forces-reconnecting-to-ActiveMQ-tp5750224.html
> > Sent from the Camel - Users mailing list archive at Nabble.com.
>
>
>
> --
> Claus Ibsen
> -----------------
> Red Hat, Inc.
> Email: cibsen@redhat.com
> Twitter: davsclaus
> Blog: http://davsclaus.com
> Author of Camel in Action: http://www.manning.com/ibsen
> hawtio: http://hawt.io/
> fabric8: http://fabric8.io/
>

Re: Camel transaction handler forces reconnecting to ActiveMQ

Posted by Claus Ibsen <cl...@gmail.com>.
On Mon, Apr 14, 2014 at 3:24 PM, nqbeel <a....@gmail.com> wrote:
> Trying to set up a route with transaction handling on a camel, this leads to
> connection to the activeMQ drop and reconnect every few milliseconds is this
> expected, is there a work around?
>

Do you use caching as recommended here, eg see that 2nd box on the top
of the page
http://camel.apache.org/jms


> Logs showing repeatedly reconnecting to ActiveMQ server:
>
> ActiveMQ FailoverTransport Successfully connected to
> ssl://serveraddress:61617
> ActiveMQ FailoverTransport Successfully connected to
> ssl://serveraddress:61617
> ActiveMQ FailoverTransport Successfully connected to
> ssl://serveraddress:61617
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Camel-transaction-handler-forces-reconnecting-to-ActiveMQ-tp5750224.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
Red Hat, Inc.
Email: cibsen@redhat.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen
hawtio: http://hawt.io/
fabric8: http://fabric8.io/