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 00DBD9FEA for ; Sat, 13 Oct 2012 08:33:11 +0000 (UTC) Received: (qmail 45610 invoked by uid 500); 13 Oct 2012 08:33:10 -0000 Delivered-To: apmail-camel-users-archive@camel.apache.org Received: (qmail 45096 invoked by uid 500); 13 Oct 2012 08:33:06 -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 45068 invoked by uid 99); 13 Oct 2012 08:33:05 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 13 Oct 2012 08:33:05 +0000 X-ASF-Spam-Status: No, hits=-0.7 required=5.0 tests=RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of claus.ibsen@gmail.com designates 209.85.217.173 as permitted sender) Received: from [209.85.217.173] (HELO mail-lb0-f173.google.com) (209.85.217.173) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 13 Oct 2012 08:33:01 +0000 Received: by mail-lb0-f173.google.com with SMTP id gj3so3166231lbb.32 for ; Sat, 13 Oct 2012 01:32:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type:content-transfer-encoding; bh=+VPurdsVBfhsc+m6oCSW6+jmn8RIqLQDMqD96JHRwe0=; b=YHQTq0yfJwieLSDSnRhfa2Pj3HkpU0uu7i+HWPBZ3Yi63OB/tPLVG0RP4mn9MRYpsg Ou6HVs8v7FAlg4fV0jbcxwLXsCoOg1jYWP7Vje6TF8Xx8jAgcTT/OQItWTsKmxeGAwM6 /w9qelqeYkLbeyEzW/QbRrSxGV8dON53Ks+A7hNhuVXX0zqOqQW3dgxZ4s5J9vmTdMRg G/e6M7MDdPjDmgZg1Z6xRiI7TZeKDirX++mR797uZb+BeKUnHsBhTi8y1+F5Q4vNnNJs FJMdSetuN2BrgXqERTSh1owRvY9MB4b9yMSxNKsvxo4xc5OlzdHpCApzR6/+msVuws9g b2VQ== Received: by 10.152.106.79 with SMTP id gs15mr5758632lab.31.1350117159790; Sat, 13 Oct 2012 01:32:39 -0700 (PDT) MIME-Version: 1.0 Received: by 10.112.42.9 with HTTP; Sat, 13 Oct 2012 01:32:19 -0700 (PDT) In-Reply-To: <06139A918ACCA041BF46A0F36940C7FA4FE890DE@exch-mbx2.msk.trd.ru> References: <06139A918ACCA041BF46A0F36940C7FA4FE890DE@exch-mbx2.msk.trd.ru> From: Claus Ibsen Date: Sat, 13 Oct 2012 10:32:19 +0200 Message-ID: Subject: Re: Single instance of running route in the cluster To: users@camel.apache.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Virus-Checked: Checked by ClamAV on apache.org On Wed, Oct 10, 2012 at 3:26 PM, Zhemzhitsky Sergey wrote: > Hello guys, > > What is the best way to have a single instance of running route in the cl= uster (multiple instances of the same route deployed on the different conta= iners)? > The example of such a requirement is a ftp/smpp access with a limited num= ber of connections. So only one instance of route is allowed to run at any = single point of time. > > Currently there is ZooKeeperRoutePolicy that seems to fit these requireme= nts, but it seems to lock the routes only when an exchange is already start= ed, i.e. ftp connection has been established (look at onExchangeBegin here = http://camel.apache.org/maven/camel-2.9.0/camel-zookeeper/apidocs/org/apach= e/camel/component/zookeeper/policy/ZooKeeperRoutePolicy.html#onExchangeBegi= n%28org.apache.camel.Route,%20org.apache.camel.Exchange%29) That code ought to be triggered on the onInit callback, then the leader election can be run prior to routes starting up. If not then feel free to log a JIRA and as usual we love contributions, so patches is welcome. > Also for this issues Hazelcast with its distributed locks can be used. > > So what is the best way to have the backup routes and only single running= route among the multiple similar routes? > Does camel have a standard solution for such issues? > Zookeeper is good but it requires to run zookeeper instances. There is also quartz which has a logic for this. And then there is Fuse Fabric which has this baked in as well. http://fabric.fusesource.org/ > Best Regards, > Sergey > > > _______________________________________________________ > CONFIDENTIALITY NOTICE: This email and any files attached to it may be co= nf idential. If you are not the intended recipient you are notified that us= ing, copying, distributing or taking any action in reliance on the contents= of this information is strictly prohibited. If you have received this emai= l in error please notify the sender and delete this email. --=20 Claus Ibsen ----------------- Red Hat, Inc. FuseSource is now part of Red Hat Email: cibsen@redhat.com Web: http://fusesource.com Twitter: davsclaus Blog: http://davsclaus.com Author of Camel in Action: http://www.manning.com/ibsen