camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jamie3 <jam...@gmail.com>
Subject Re: Shutting down route with jms
Date Mon, 01 Feb 2016 19:57:34 GMT
A bit of an update. I changed the code to use control bus. The logs show that
control bus is signaling to the camel context to shut down, however when
inspecting the debug thread, the Camel JMSConsumer class is still running,
as shown below with 1 inflight and pending exchange. My processor logic will
not mark the JMS message as acknowledged. I haven't looked at whether camel
is rolling back the JMS transaction. It appears the JMSConsumer thread is
waiting for the transaction to be rolled back.

2016-02-01 12:53:21 ERROR DeliveryRouter:145 - Failed to send email.
Shutting down delivery engine
2016-02-01 12:53:21 INFO  DefaultCamelContext:1833 - Apache Camel 2.13.0
(CamelContext: camel-1) is shutting down
2016-02-01 12:53:21 INFO  DefaultShutdownStrategy:173 - Starting to graceful
shutdown 1 routes (timeout 10 seconds)
2016-02-01 12:53:21 INFO  DefaultShutdownStrategy:573 - Waiting as there are
still 1 inflight and pending exchanges to complete, timeout in 10 seconds.
2016-02-01 12:53:22 INFO  DefaultShutdownStrategy:573 - Waiting as there are
still 1 inflight and pending exchanges to complete, timeout in 9 seconds.
2016-02-01 12:53:23 INFO  DefaultShutdownStrategy:573 - Waiting as there are
still 1 inflight and pending exchanges to complete, timeout in 8 seconds.
2016-02-01 12:53:24 INFO  DefaultShutdownStrategy:573 - Waiting as there are
still 1 inflight and pending exchanges to complete, timeout in 7 seconds.
2016-02-01 12:53:25 INFO  DefaultShutdownStrategy:573 - Waiting as there are
still 1 inflight and pending exchanges to complete, timeout in 6 seconds.
2016-02-01 12:53:26 INFO  DefaultShutdownStrategy:573 - Waiting as there are
still 1 inflight and pending exchanges to complete, timeout in 5 seconds.
2016-02-01 12:53:27 INFO  DefaultShutdownStrategy:573 - Waiting as there are
still 1 inflight and pending exchanges to complete, timeout in 4 seconds.
2016-02-01 12:53:28 INFO  DefaultShutdownStrategy:573 - Waiting as there are
still 1 inflight and pending exchanges to complete, timeout in 3 seconds.
2016-02-01 12:53:29 INFO  DefaultShutdownStrategy:573 - Waiting as there are
still 1 inflight and pending exchanges to complete, timeout in 2 seconds.
2016-02-01 12:53:30 INFO  DefaultShutdownStrategy:573 - Waiting as there are
still 1 inflight and pending exchanges to complete, timeout in 1 seconds.
2016-02-01 12:53:31 WARN  DefaultShutdownStrategy:202 - Timeout occurred.
Forcing the routes to be shutdown now.
2016-02-01 12:53:31 WARN  DefaultShutdownStrategy:581 - Interrupted while
waiting during graceful shutdown, will force shutdown now.
2016-02-01 12:53:31 INFO  DefaultShutdownStrategy:610 - Route: route1
shutdown complete, was consuming from:
Endpoint[mq://queue:ENS.NOTIFICATION.Q?acknowledgementModeName=CLIENT_ACKNOWLEDGE&concurrentConsumers=10]


.

		// 10 threads used to connect to IBM MQ
		// If messages are successfully sent to email server we will commit the
transaction, otherwise rollback
		// to MQ and shutdown the route if fails more than 3 times in a single
exchange
		String props =
		"?concurrentConsumers=10" +
		"&acknowledgementModeName=CLIENT_ACKNOWLEDGE";
		
		Endpoint mq = endpoint("mq:queue:ENS.NOTIFICATION.Q" + props);
		Endpoint shutdownRoute =
endpoint("controlbus:language:simple?async=true");
		
		// wait 30 seconds
		getContext().getShutdownStrategy().setTimeout(10);
		getContext().getShutdownStrategy().setSuppressLoggingOnTimeout(true);
		
		onException(EmitException.class)
			.maximumRedeliveries(2)
			.handled(false)
			.delay(3000)
			.log(LoggingLevel.ERROR, "Failed to send email. Shutting down delivery
engine")
			.setBody(simple("${camelContext.stop()}"))
			.to(shutdownRoute)
			.end();
		
		// Routing logic for processing the message
		from(mq)
		.id("delivery")
		.process(messageHandler);



--
View this message in context: http://camel.465427.n5.nabble.com/Shutting-down-route-with-jms-tp5777011p5777113.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Mime
View raw message