Basically I am trying to achieve load balancing in consuming files using file
endpoint. 

I have gone through some use case which uses zookeeper route policy to
control the master election of camel routes. I am planning to apply this
zookeperRoutePolicy to my camel routes which has file end points as
consumers.

For example If I configured the zookeeper route policy as mentioned below 

ZooKeeperRoutePolicy routePolicy = 
    new
ZooKeeperRoutePolicy("zookeeper://localhost::2181/someapp/somepolicy", 3);

and assign this route policy to the file consumer endpoint as

from("file://input").routeId("fileConsumerRoute")
    .routePolicy(zooKeeperRoutePolicy)
    .process(new Processor() {
          public void process(Exchange exchange) throws Exception {
                // do some business logic with the input body
          }
     })
.end();

then I will have 3 active routes (polling to the same file path) implemented
using zookeeper route policy. The default behavior would be like all the 3
routes will poll the same file path and will result in race condition to
process the files, which ever route picks the lock for the file will process
it. 

The route which has successfully gained the lock would create an exchange
and pass it down to the next processor. 

Correct me If I am wrong on this. 

Is there an efficient way to achieve round robin kind of load balancing
(within the group of active nodes) using file endpoint to evenly distribute
the work load even before the exchange is being passed to the next
processor.

What I wanted to know, is it possible when File1 arrives the Master 1
consumes it, when File2 arrives the Master 2 consumes it, when File3 arrives
the Master 3 consumes it and so on based on the load and the available
active file consumer route that are active in the master cluster



--
View this message in context: 
http://camel.465427.n5.nabble.com/Zookeeper-RoutePolicy-implementation-in-File-endpoint-tp5778594.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Reply via email to