Return-Path: X-Original-To: apmail-camel-users-archive@www.apache.org Delivered-To: apmail-camel-users-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 22BBC93DB for ; Tue, 8 Nov 2011 13:13:31 +0000 (UTC) Received: (qmail 2155 invoked by uid 500); 8 Nov 2011 13:13:30 -0000 Delivered-To: apmail-camel-users-archive@camel.apache.org Received: (qmail 2121 invoked by uid 500); 8 Nov 2011 13:13:30 -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 Received: (qmail 2112 invoked by uid 99); 8 Nov 2011 13:13:30 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 08 Nov 2011 13:13:30 +0000 X-ASF-Spam-Status: No, hits=1.5 required=5.0 tests=FREEMAIL_FROM,HTML_MESSAGE,RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of wingtung.leung@gmail.com designates 74.125.82.41 as permitted sender) Received: from [74.125.82.41] (HELO mail-ww0-f41.google.com) (74.125.82.41) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 08 Nov 2011 13:13:24 +0000 Received: by wwf27 with SMTP id 27so6145633wwf.2 for ; Tue, 08 Nov 2011 05:13:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type; bh=3MJANU2WAkLwvp/eaw2/3Ftd7JbGf4utqD1WckM9XF4=; b=qmgnlS8pee/gkUixZh4mHnQQyzGIyxna24GiLjI7mORcAJSFhpmu9jvJc1x0zbqAxE TgTMbYfgh5ltDVCmNlz5K5AxxsXI0VMnIhxX5wsSHJOwwSWjGsLZnSlufsbaajnm2WvX f8d9+ySQ91fbXHmwaLqNgLUvPSz3e3jDqBv50= MIME-Version: 1.0 Received: by 10.216.12.82 with SMTP id 60mr4304634wey.97.1320757983691; Tue, 08 Nov 2011 05:13:03 -0800 (PST) Received: by 10.216.197.6 with HTTP; Tue, 8 Nov 2011 05:13:03 -0800 (PST) Date: Tue, 8 Nov 2011 14:13:03 +0100 Message-ID: Subject: Starting routes in StartupListener From: wing-tung Leung To: users@camel.apache.org Content-Type: multipart/alternative; boundary=0016364d25db73c5b804b138ee22 X-Virus-Checked: Checked by ClamAV on apache.org --0016364d25db73c5b804b138ee22 Content-Type: text/plain; charset=ISO-8859-1 Hello, my camel context contains a few routes which should not be started automatically, but it should run a business check first for those routes. My initial idea is to disable "autoStartup" for those routes, and add a custom StartupListener which performs the check and simply calls "startRoute()" on the context if the check passes. But, this fails to work because "DefaultCamelContext.startRouteService()" checks the camel context is already started or not, and the listeners are already invoked BEFORE setting the "started" flag, just AFTER starting all relevant routes. Listeners are called in the "doStart()" method, BEFORE setting the "started" flag: https://github.com/apache/camel/blob/trunk/camel-core/src/main/java/org/apache/camel/support/ServiceSupport.java#L51 I have the feeling that the documentation of the StartupListener can be improved here, or should the listeners be invoked AFTER the complete start of the context? http://camel.apache.org/maven/current/camel-core/apidocs/org/apache/camel/StartupListener.html If this is intended behavior: other ideas to achieve my goal? Starting routes in "suspended" mode? Use separate Spring bean and "depends-on" which starts the routes AFTER the complete startup of the initial context? (running on camel 2.6.0, but the related code looks similar in current trunk) Any advice is greatly appreciated, Tung --0016364d25db73c5b804b138ee22--