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 0DA25200C84 for ; Mon, 29 May 2017 18:17:17 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 08FDE160BCE; Mon, 29 May 2017 16:17:17 +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 295BD160BC2 for ; Mon, 29 May 2017 18:17:16 +0200 (CEST) Received: (qmail 43098 invoked by uid 500); 29 May 2017 16:17:14 -0000 Mailing-List: contact dev-help@camel.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@camel.apache.org Delivered-To: mailing list dev@camel.apache.org Received: (qmail 43086 invoked by uid 99); 29 May 2017 16:17:14 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd2-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 29 May 2017 16:17:14 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd2-us-west.apache.org (ASF Mail Server at spamd2-us-west.apache.org) with ESMTP id 20AFA1A00A5 for ; Mon, 29 May 2017 16:17:14 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd2-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -2.401 X-Spam-Level: X-Spam-Status: No, score=-2.401 tagged_above=-999 required=6.31 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-2.8, RCVD_IN_SORBS_SPAM=0.5, SPF_PASS=-0.001] autolearn=disabled Authentication-Results: spamd2-us-west.apache.org (amavisd-new); dkim=pass (2048-bit key) header.d=gmail.com Received: from mx1-lw-us.apache.org ([10.40.0.8]) by localhost (spamd2-us-west.apache.org [10.40.0.9]) (amavisd-new, port 10024) with ESMTP id Jt8HyY5hMVKz for ; Mon, 29 May 2017 16:17:12 +0000 (UTC) Received: from mail-io0-f175.google.com (mail-io0-f175.google.com [209.85.223.175]) by mx1-lw-us.apache.org (ASF Mail Server at mx1-lw-us.apache.org) with ESMTPS id 8F68E5F523 for ; Mon, 29 May 2017 16:17:12 +0000 (UTC) Received: by mail-io0-f175.google.com with SMTP id f102so43249946ioi.2 for ; Mon, 29 May 2017 09:17:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to; bh=N+mTZKebmOg4Ox1kWQeU57yPibmA6IPF3SxcHwf2I/E=; b=JI8M4ng5QwFXXmXcSDsWP+ukkYrOpx8KKDoSXh9q5pQqmyxf2X658fFo1tLu/Hrkkt x0ErFylWaGKYg08bVieouX1fSr9G6+i6qZMbbJP0epW4U0fU/6Z/cpZ/FFCGsdyRCz5H oK2hRdcfVOpPZHFfNByZiQP1gr+UfTl0ViXxrKei/bjj+NefQm3NCua6ngBKtBIwDlmu 0t8Vt51ojCmpDJJNJMLdyBZbHe65JgUjgbaecd5G1//YqR4D8SZcirbO+VgqbFptpBxO hvu0rMHDHKok51zfjg9HyHjRn1mWEOPqe+aZPHdz6zosvGZfMZgFdNyKiOf725LWnN+3 jYtA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to; bh=N+mTZKebmOg4Ox1kWQeU57yPibmA6IPF3SxcHwf2I/E=; b=H/2pVfFYQxMZoXJNcCKWrR6BTVoBjgf8I9f/FhEFZDWDXtwVjEfmjrHHzmEjlJA1U3 34CsHDk7E+z6tGV+tqDGbk0Y0erKDLHqf6QyWuF78XKH2fzdXaBeoldSFxC0acHfAt3S GgZfzKssiJS46oEeWDaI631oYTtd2wMQ4hZqQtHy46RYM9IF3Tgwnthy3p4qhSNY3vIf 2XYINM2rVc1csnse867fJ6wGW4VC8wOL3fcA92UkocBQWBMGBedh4lqRE8QjLMyCBsaS HsXXQ8B8q4uvnCFd/AbmXFZ1iIgD+qoQuOQ12HL24Cl6dO1ylINBCB/V4t9Qu7EHAPWq bHdg== X-Gm-Message-State: AODbwcAXULsUwVso/zsy7fMwaZ/Di2g73XnRZn1fz89aiRQLXuBjFnc8 kMNprIamDwwePoXGYrL/GIn7kw1bUQf5eYo= X-Received: by 10.107.130.166 with SMTP id m38mr15193918ioi.87.1496074631576; Mon, 29 May 2017 09:17:11 -0700 (PDT) MIME-Version: 1.0 Received: by 10.79.91.130 with HTTP; Mon, 29 May 2017 09:17:10 -0700 (PDT) In-Reply-To: References: From: Luca Burgazzoli Date: Mon, 29 May 2017 18:17:10 +0200 Message-ID: Subject: Re: Master/Leader RoutePolicy deprecation/fix To: dev@camel.apache.org Content-Type: text/plain; charset="UTF-8" archived-at: Mon, 29 May 2017 16:17:17 -0000 Make sense, will raise the JIRAs soon to create the LeaderElectionService which can the be leveraged by Dhiraj on CAMEL-10320 and route policies. --- Luca Burgazzoli On Mon, May 29, 2017 at 5:48 PM, Nicola Ferraro wrote: > To me it seems that the route policy has everything needed to create > master/slave routes. The autostartup=false flag can be forced on the > "onInit" callback method as done in [3]. I think it's ok doing so, because > it's responsibility of the policy to change standard behavior of the route. > > I've seen some leader election policies implemented in Camel and I think > they are pretty similar. So I was thinking why we don't define just a > single LeaderElectionRoutePolicy in Camel core. It will manage the burden > of starting/stopping consumers (that is a delicate task and needs to take > care of many details) and will be notified by a specific > "LeaderElectionService" when gaining or losing the leadership (a callback > method with a boolean argument). This way, each leader election "algorithm" > needs just to implement the "LeaderElectionService" interface and just > decide when he is the leader (and when he's no more), nothing else. > > This will also allow us to re-use leader election easily outside the > purpose of starting/stopping camel routes. And it is a good thing for us > developing Camel, but we can also expose leader election services directly > to users, because creating a cluster-wide singleton service is not a > trivial task, but Camel can to it easily. > > In conclusion, for me: > - RoutePolicy wins over master > - Better having just 1 generic LeaderRoutePolicy and a specific > LeaderElectionService for each "algorithm" > > > Nicola > > On Mon, May 29, 2017 at 4:57 PM, Claus Ibsen wrote: > >> Hi >> >> Yeah the set auto startup=false seems like a good idea. >> >> On Mon, May 29, 2017 at 4:44 PM, Luca Burgazzoli >> wrote: >> > Hello, >> > >> > I did a small review of the RoutePolicy we have for having one route >> > master and one slave and all have an issue as they are invoked after >> > the route is started so the consumer may have the time to consume some >> > data before the policy kicks in [1]. >> > >> > There is now a zookeeper-master component and some work is in in >> > progress [2] in such area so wondering if we should deprecate such >> > policies once [2] is done with or without fixing them. >> > >> > If we decide to fix them we could make the route to not auto start on >> > policy initialization so then the policy could take care to start/stop >> > the routes it is supposed to manage, an example of such behaviour can >> > be see in my experimental branch [3] and in CuratorLeaderPolicy [4]. >> > >> > Thoughts ? >> > >> > [1] https://github.com/apache/camel/blob/master/camel-core/ >> src/main/java/org/apache/camel/impl/RouteService.java#L213-L232 >> > [2] https://issues.apache.org/jira/browse/CAMEL-10320 >> > [3] https://github.com/lburgazzoli/apache-camel/blob/ >> route-policy/components/camel-infinispan/src/main/java/org/ >> apache/camel/component/infinispan/policy/InfinispanRoutePolicy.java >> > [4] https://github.com/apache/camel/blob/master/components/ >> camel-zookeeper/src/main/java/org/apache/camel/component/zookeeper/policy/ >> CuratorLeaderRoutePolicy.java >> > >> > --- >> > Luca Burgazzoli >> >> >> >> -- >> Claus Ibsen >> ----------------- >> http://davsclaus.com @davsclaus >> Camel in Action 2: https://www.manning.com/ibsen2 >>