Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 26790200B87 for ; Mon, 19 Sep 2016 13:47:03 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 24FBB160ADC; Mon, 19 Sep 2016 11:47:03 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 69431160ABC for ; Mon, 19 Sep 2016 13:47:02 +0200 (CEST) Received: (qmail 95256 invoked by uid 500); 19 Sep 2016 11:47:01 -0000 Mailing-List: contact users-help@camel.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: users@camel.apache.org Delivered-To: mailing list users@camel.apache.org Delivered-To: moderator for users@camel.apache.org Received: (qmail 58408 invoked by uid 99); 19 Sep 2016 11:19:40 -0000 X-Virus-Scanned: Debian amavisd-new at spamd4-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 3.722 X-Spam-Level: *** X-Spam-Status: No, score=3.722 tagged_above=-999 required=6.31 tests=[FORGED_HOTMAIL_RCVD2=1.187, FREEMAIL_ENVFROM_END_DIGIT=0.25, RCVD_IN_DNSWL_NONE=-0.0001, SPF_SOFTFAIL=0.972, URI_HEX=1.313] autolearn=disabled Date: Mon, 19 Sep 2016 04:19:36 -0700 (MST) From: redpower1989 To: users@camel.apache.org Message-ID: <1474283976513-5787725.post@n5.nabble.com> Subject: Database route shutdown MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit archived-at: Mon, 19 Sep 2016 11:47:03 -0000 Hello i am trying to stop the route when the application detects that there is no database connection. First in camelContect org.springframework.jdbc.CannotGetJdbcConnectionException Inside my stopRoutePolicy bean: public void onExchangeBegin(Route route, Exchange exchange) { CamelContext context = exchange.getContext(); String routeId = exchange.getFromRouteId(); if (context.getRouteStatus(routeId) != null && context.getRouteStatus(routeId).isStarted()) { try { exchange.getContext().getInflightRepository().remove(exchange); LOG.info("Stopping route: {}", routeId); context.stopRoute(routeId); } catch (Exception exception) { getExceptionHandler().handleException(exception); } } } and i am getting this log messages Exchange[ID-FC8BG42-49403-1474282224072-1-7] 19 Sep 2016 11:52:34 StopRoutePolicyDatabase INFO Stopping route: routeId 19 Sep 2016 11:52:34 DefaultShutdownStrategy INFO Starting to graceful shutdown 1 routes (timeout 10 seconds) 19 Sep 2016 11:52:34 [ext) thread #19 - ShutdownTask DefaultShutdownStrategy INFO Waiting as there are still 1 inflight and pending exchanges to comple te, timeout in 10 seconds. Inflights per route: routeId = 1 19 Sep 2016 11:52:35 [ext) thread #19 - ShutdownTask DefaultShutdownStrategy INFO Waiting as there are still 1 inflight and pending exchanges to comple te, timeout in 9 seconds. Inflights per route: routeId = 1 ... 19 Sep 2016 11:52:44 DefaultShutdownStrategy WARN Timeout occurred during graceful shutdown. Forcing the routes to be s hutdown now. Notice: some resources may still be running as graceful shutdown di d not complete successfully. 19 Sep 2016 11:52:44 [ext) thread #19 - ShutdownTask] DefaultShutdownStrategy WARN Interrupted while waiting during graceful shutdown, will force shutdo wn now. 19 Sep 2016 11:52:44 [ext) thread #19 - ShutdownTask] DefaultShutdownStrategy INFO Route: routeId shutdown complete, was consuming from: En dpoint My question is as i use : exchange.getContext().getInflightRepository().remove(exchange); Still when i am trying to stop the route why am i getting messages that there is inflight and pending exchanges to complete? How can i avoid this situation? Also when i use context.getShutdownStrategy().setTimeout(30); it does not seems to change the timeout. -- View this message in context: http://camel.465427.n5.nabble.com/Database-route-shutdown-tp5787725.html Sent from the Camel - Users mailing list archive at Nabble.com.