camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From paulvitic <pa...@vektortelekom.com>
Subject JMS queue consumer hangs
Date Wed, 06 Apr 2011 11:33:45 GMT
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.

Mime
View raw message