You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by paulvitic <pa...@vektortelekom.com> on 2011/04/06 13:33:45 UTC

JMS queue consumer hangs

I have a route with a JMS consumer as starting endpoint. The configuration
details of the endpoint are as follows:

connectionFactory = org.apache.activemq.pool.PooledConnectionFactory
explicitQosEnabled = true
deliveryPersistent = false
timeToLive = 3600000
sessionAcknowledgeModeName = AUTO_ACKNOWLEDGE

The purpose of this route is to send some text based messages to remote
clients either via TCP or if there is no live TCP connection with the client
send the message via appropriate HTTP or SMPP gateways. 

The throughput of the route is intermittent, i.e. sometime there are
approxiamtely 20 messages per second and sometimes there are 1 message per
minute.

The first endpoint on the route is a processor which checks if recipient
client has a live MINA TCP session and if so sends the message with the
following code snipplet: 

if (session != null && session.isConnected()) {	
			WriteFuture future = session.write(rawMessage);
			future.join(10 * 1000L);
			if (!future.isWritten()) {
				log.info("Cannot write body: " + rawMessage + " using session: " +
session);
				throw new CamelExchangeException("Cannot write body", exchange);
			} else {
				outgoing.setPosted(true);
				log.info("GPRS:ยป " + rawMessage.replaceAll("(\\r|\\n)", ""));
			}  

if not it routes the message to subsequent HTTP or SMPP based endpoint based
on condition. Here is the route DSL:

from("gatewayQueue:queue:OUTGOING").inOnly()
.processRef("tcpDeliverer")
.choice()			
.when("someCondition")
.processRef("processorThatSendsMessageViaHTTPPost")
.when("anotherCondition"))
.to("smpp:smppConfiguration")
.otherwise().end()
.processRef("finalProcessorToHandleSentMessage").end(); 

The route generally works fine. I can see messages going out from any of the
producer endpoints when appropriate conditions are met.

However, at times that I can not specify the JMS consumer hangs. Messages
build up on the queue. I can not restart the route via Camel JMX extensions.
When I try to shutdown I get the following message:

DefaultShutdownStrategy - Waiting as there are still 1 inflight and pending
exchanges to complete, timeout in 299 seconds.

Any advise on how I can improve the route so I dont get into this situation
(may be by tweaking JMS configuration or using asynchronous processors etc.)
and/or how I can recover from the hung route is welcome.

Thanks in advance,
Paul

--
View this message in context: http://camel.465427.n5.nabble.com/JMS-queue-consumer-hangs-tp4286088p4286088.html
Sent from the Camel - Users mailing list archive at Nabble.com.

RE: JMS queue consumer hangs

Posted by paulvitic <pa...@vektortelekom.com>.
Hello Mike,

I am indeed using 5.4.1 and I will take your advice and try to upgrade to
5.5.0.

However I think the problem may be something else. To see where exactly the
route is failing I changed my configuration a little bit:

===========================================

from("gatewayQueue:queue:OUTGOING").inOnly()
.processRef("tcpDeliverer")
.choice()
.when("someCondition").to("seda:TCP")
.otherwise().choice()
.when("anotherCondition").to("seda:HTTPDeliverer")
.when("yetAnotherCondition").to("seda:SMPP")
.otherwise();
		
from("seda:SMPP").inOnly().to("smpp:smppConfiguration").processRef("finalProcessorToHandleSentMessage");

from("seda:HTTPDeliverer").inOnly().processRef("processorThatSendsMessageViaHTTPPost").processRef("finalProcessorToHandleSentMessage");
		
from("seda:TCP").inOnly().processRef("finalProcessorToHandleSentMessage");

======================================

This time I realized that the seda:TCP consumer is hanging but the while
this happens the JMS consumer kept on flowing. 

It turns out that there is some issue with the
"finalProcessorToHandleSentMessage" processor. This processor is trying to
put the message object into a cache and there seems to be some problems with
this operation. 

Nevertheless I am still a little confused as to why the consumer queues stop
consuming in such a situation since in all circumstances they are inOnly.


--
View this message in context: http://camel.465427.n5.nabble.com/JMS-queue-consumer-hangs-tp4286088p4288588.html
Sent from the Camel - Users mailing list archive at Nabble.com.

RE: JMS queue consumer hangs

Posted by "Mike L." <pa...@hotmail.com>.
Paul:

What version of ActiveMQ are you using? Using version 5.4.x I had a similar problem, which is described in this thread: 

http://camel.465427.n5.nabble.com/InOut-over-JMS-always-leads-to-Timout-ExchangeTimedOutException-td4237336.html

Try going back to 5.3.x or use the new 5.5.0!

HTH,

Mike L. (aka patzerbud)


> Date: Wed, 6 Apr 2011 04:37:46 -0700
> To: users@camel.apache.org
> Subject: Re: JMS queue consumer hangs
> 
> Another note I would like to add is since the subsequent endpoints after the
> "tcpDeliverer" processor are slow. For example the processor that sends
> message via HTTP post may need to get a session from the remote HTTP server
> first and than send the message.
> 
> I am using Camel version 2.5
> 
> Thanks
> Paul 
> 
> --
> View this message in context: http://camel.465427.n5.nabble.com/JMS-queue-consumer-hangs-tp4286088p4286093.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
 		 	   		  

Re: JMS queue consumer hangs

Posted by paulvitic <pa...@vektortelekom.com>.
Another note I would like to add is since the subsequent endpoints after the
"tcpDeliverer" processor are slow. For example the processor that sends
message via HTTP post may need to get a session from the remote HTTP server
first and than send the message.

I am using Camel version 2.5

Thanks
Paul 

--
View this message in context: http://camel.465427.n5.nabble.com/JMS-queue-consumer-hangs-tp4286088p4286093.html
Sent from the Camel - Users mailing list archive at Nabble.com.