You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by "Willem.Jiang" <wi...@gmail.com> on 2010/07/05 03:14:05 UTC

Re: Instance is not consuming any messages

How did you setup your activemq connection ?
It looks like the connection can't reconnect after long time running.

Willem
----------------------------------
Apache Camel, Apache CXF committer
Open SOA http://www.fusesource.com
Blog http://willemjiang.blogspot.com
Tiwtter http://twitter.com/willemjiang 


Sri wrote:
> 
> HI,
> 
> I have create an processor to consume the messages from queue. 
> 
> And I have created 4 instances of these processors to consume the
> messages. 
> But I realised after some time, say 2 or 3 days , some instances (say 2 )
> are not consuming the messages from the respective queue and there are no
> message even in the log. 
> 
> when I saw it on the server the instances are still runinng ( I mean by ps
> -ef | grep ). 
> 
> But on the activemq , I can see the consumers number comes down to 2 and
> the other 2 instances are not consuming any messages. 
> 
> is there any wayto find out why the instances stopped consuming the
> message even though the processors are still running 
> 
> is the context is dying after sometime?.
> 
> can context.setAutoStartup(true) will make it work in that case?
> 
> can any body help me on this?
> 
> 
> Regards
> Sri
> 
>  
>  
> 
-- 
View this message in context: http://camel.465427.n5.nabble.com/Instance-is-not-consuming-any-messages-tp512624p655127.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Instance is not consuming any messages

Posted by Sri <sr...@googlemail.com>.

I checked somewhere that we can add maxInactivityDuration option to the
activeMQ URL 
ie.
wireFormat.maxInactivityDuration=0 

brokerconnection
=tcp://dev01.sportingstatz.com:61616?wireFormat.maxInactivityDuration=0

will this solves the above above problem. 
-- 
View this message in context: http://camel.465427.n5.nabble.com/Instance-is-not-consuming-any-messages-tp512624p1044687.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Instance is not consuming any messages

Posted by Sri <sr...@googlemail.com>.
Env : 
Java : 1.6
Camel : 2.2 snaphot 
ActiveMQ : 5.2.0


Here is the code that I am using it for reading the messages from the Active
MQ

		// Creating Camel Context
		final CamelContext context = new DefaultCamelContext();
		ConnectionFactory connectionFactory = new
ActiveMQConnectionFactory("tcp://dev01.somehost.com:61616);

		// naming the component
		context.addComponent("activemq", JmsComponent
				.jmsComponentAutoAcknowledge(connectionFactory));
		context.addComponent("jms-cillit", JmsComponent
				.jmsComponentAutoAcknowledge(connectionFactory));

		final FeedProcessor feedProcessor = new FeedProcessor(properties);
		
		try {
			context.addRoutes(new RouteBuilder() {
				@Override
				public void configure() {
					
				
from("activemq:queue.feed.notification.test_sridev").process(feedProcessor);
					
				}
			});
		} catch (Exception e) {
			logger.warn("unable to add the component to the context ");
		}
		
		context.start();

                            Runtime rt = Runtime.getRuntime();
		rt.addShutdownHook(new Thread() {
		      public void run() {
		          logger.info("calling shutdown hook for graceful shutdown");
		        try {
					context.stop();
				} catch (Exception e) {
					// TODO Auto-generated catch block
					logger.warn("Exception occured while stopping the service");
				}
		      }
		});



             I added a shutdown hook as well to handled the gracefulshut
down feature.


when I killed the process I am getting the following exception 

[2010-07-05 18:01:59,000][INFO][com.optasports.valde.cillit.CILLIT$2]
calling shutdown hook for graceful shutdown
[2010-07-05
18:01:59,222][INFO][org.apache.camel.impl.DefaultCamelContext] Apache Camel 
(CamelContext:camel-1) is stopping
[2010-07-05
18:01:59,234][INFO][org.apache.camel.impl.DefaultShutdownStrategy]
Starting to graceful shutdown routes (timeout 300 seconds)
[2010-07-05
18:01:59,284][INFO][org.apache.camel.impl.DefaultShutdownStrategy$ShutdownTask]
Route: route1 suspended and shutdown deferred.
[2010-07-05 18:02:00,182][INFO][org.apache.activemq.AdvisoryConsumer]
Failed to send remove command: javax.jms.JMSException: Channel was inactive
for too long: valdemid01.sportingstatz.com/10.60.2.52:61616
javax.jms.JMSException: Channel was inactive for too long: 
valdemid01.sportingstatz.com/10.60.2.52:61616
        at
org.apache.activemq.util.JMSExceptionSupport.create(JMSExceptionSupport.java:62)
        at
org.apache.activemq.ActiveMQConnection.doAsyncSendPacket(ActiveMQConnection.java:1216)
        at
org.apache.activemq.ActiveMQConnection.asyncSendPacket(ActiveMQConnection.java:1208)
        at
org.apache.activemq.AdvisoryConsumer.dispose(AdvisoryConsumer.java:56)
        at
org.apache.activemq.ActiveMQConnection.close(ActiveMQConnection.java:599)
        at
org.springframework.jms.connection.ConnectionFactoryUtils.releaseConnection(ConnectionFactoryUtils.java:81)
        at
org.springframework.jms.listener.AbstractJmsListeningContainer.shutdown(AbstractJmsListeningContainer.java:219)
        at
org.springframework.jms.listener.AbstractJmsListeningContainer.destroy(AbstractJmsListeningContainer.java:149)
        at
org.apache.camel.component.jms.JmsConsumer.doStop(JmsConsumer.java:132)
        at org.apache.camel.impl.ServiceSupport.stop(ServiceSupport.java:81)
        at
org.apache.camel.impl.ServiceSupport.stop(ServiceSupport.java:100)
        at
org.apache.camel.util.ServiceHelper.stopService(ServiceHelper.java:93)
        at
org.apache.camel.impl.DefaultShutdownStrategy.shutdownNow(DefaultShutdownStrategy.java:179)
        at
org.apache.camel.impl.DefaultShutdownStrategy$ShutdownTask.run(DefaultShutdownStrategy.java:366)
        at
java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
        at
java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
        at java.util.concurrent.FutureTask.run(FutureTask.java:138)
        at
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
        at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
        at java.lang.Thread.run(Thread.java:619)
Caused by: org.apache.activemq.transport.InactivityIOException: Channel was
inactive for too long: valdemid01.sportingstatz.com/10.60.2.52:61616
        at
org.apache.activemq.transport.InactivityMonitor.oneway(InactivityMonitor.java:225)
        at
org.apache.activemq.transport.TransportFilter.oneway(TransportFilter.java:83)
        at
org.apache.activemq.transport.WireFormatNegotiator.oneway(WireFormatNegotiator.java:100)
        at
org.apache.activemq.transport.MutexTransport.oneway(MutexTransport.java:40)
        at
org.apache.activemq.transport.ResponseCorrelator.oneway(ResponseCorrelator.java:60)
        at
org.apache.activemq.ActiveMQConnection.doAsyncSendPacket(ActiveMQConnection.java:1214)
        ... 18 more
[2010-07-05
18:02:00,207][INFO][org.apache.camel.impl.DefaultShutdownStrategy$ShutdownTask]
Route: route1 shutdown complete.
[2010-07-05
18:02:00,210][INFO][org.apache.camel.impl.DefaultShutdownStrategy]
Graceful shutdown of routes completed in 0 seconds



Thanks in advance for your help.


Regards
Sri




















-- 
View this message in context: http://camel.465427.n5.nabble.com/Instance-is-not-consuming-any-messages-tp512624p1044674.html
Sent from the Camel - Users mailing list archive at Nabble.com.