+1 Really a great work Luca. It's completely separated from the route policy so that we can also implement the generic master component on top of it. But it can also be used for other purposes by just implementing a listener interface. The cluster view is also a clean way to monitor the cluster status.
You have also shown how to clusterize the whole context (all routes) using the route policy factory, and route policies can also be set at route level. So, merge it and I'll implement the Kubernetes cluster service with this new spec! On Wed, Jun 14, 2017 at 3:49 PM, Claus Ibsen <claus.ib...@gmail.com> wrote: > +1 > > Great work Luca. Its good to see this coming in camel-core, as we now > have many more Camel components that does clustering and leader > elections. It makes good benefit to have some common reusable code > from camel-core. > > > > On Wed, Jun 14, 2017 at 11:36 AM, Luca Burgazzoli <lburgazz...@gmail.com> > wrote: > > Hello, > > > > I've been working on CAMEL-11362 to create a leader election service > > in recent times and I've ended up with some initial bits of a > > potential clustering service for Camel [1]. > > > > So fare there are a few simple interfaces: > > - CamelClusterService > > - CamelClusterView > > - CamelClusterMember > > > > The CamelClusterService is just a regular camel service and is > > responsible to create views of the cluster; a view is like a "group" > > with its own set of resources like a leader/services/etc and i.e. > > broadcast of messages should not go beyond its borders, etc; how the > > view is mapped then depends on the underlying technology used so it > > can be a group in atomix/jgroups, a path in zk/etcd, a map in > > hazelcast/infinispan, etc. > > > > As today the View API is limited to leader election and topology > > events (member joining/leaving the view) and I've build a generic > > RoutePolicy and RoutePolicyFactory on top of them [2][3]. A future > > work may be to add support for service discovery, load balancing ad > > more. > > > > I also started the implementation of camel-atomix based on the > > atomix.io project which offers some easy to use APIs for distributed > > systems so an implementation of the API can be found here [4] and a > > test here [5]. > > > > > > Feedback is very welcome. > > > > > > [1] https://github.com/lburgazzoli/apache-camel/tree/ > CAMEL-11362/camel-core/src/main/java/org/apache/camel/ha > > [2] https://github.com/lburgazzoli/apache-camel/blob/ > CAMEL-11362/camel-core/src/main/java/org/apache/camel/ > impl/ha/ClusteredRoutePolicy.java > > [3] https://github.com/lburgazzoli/apache-camel/blob/ > CAMEL-11362/camel-core/src/main/java/org/apache/camel/impl/ha/ > ClusteredRoutePolicyFactory.java > > [4] https://github.com/lburgazzoli/apache-camel/tree/ > CAMEL-11362/components/camel-atomix/src/main/java/org/ > apache/camel/component/atomix/ha > > [5] https://github.com/lburgazzoli/apache-camel/blob/ > CAMEL-11362/components/camel-atomix/src/test/java/org/ > apache/camel/component/atomix/ha/AtomixRoutePolicyTest.java > > > > > > --- > > Luca Burgazzoli > > > > -- > Claus Ibsen > ----------------- > http://davsclaus.com @davsclaus > Camel in Action 2: https://www.manning.com/ibsen2 >