public void boot() throws Exception { // create and embed the hazelcast server // (you can use the hazelcast client if you want to connect to external hazelcast server) HazelcastInstance hz = Hazelcast.newHazelcastInstance(); // setup the hazelcast idempotent repository which we will use in the route HazelcastIdempotentRepository repo = new HazelcastIdempotentRepository(hz, "camel"); main = new Main(); // bind the hazelcast repository to the name myRepo which we refer to from the route main.bind("myRepo", repo); // add the route and and let the route be named BAR and use a little delay when processing the files main.addRouteBuilder(new FileConsumerRoute("BAR", 100)); main.run(); }
@Override public void configure() throws Exception { // read files from the shared directory // url to consume files from String url = "file:target/inbox?delete=true"; // use the zookeeper master component in the clustered group named myGroup // to run a master/slave mode in the following Camel url from("zookeeper-master:myGroup:" + url) .log(name + " - Received file: ${file:name}") .delay(delay) .log(name + " - Done file: ${file:name}") .to("file:target/outbox"); }
public void boot() throws Exception { // create and embed the hazelcast server // (you can use the hazelcast client if you want to connect to external hazelcast server) HazelcastInstance hz = Hazelcast.newHazelcastInstance(); // setup the hazelcast idempotent repository which we will use in the route HazelcastIdempotentRepository repo = new HazelcastIdempotentRepository(hz, "camel"); main = new Main(); // bind the hazelcast repository to the name myRepo which we refer to from the route main.bind("myRepo", repo); // add the route and and let the route be named BAR and use a little delay when processing the files main.addRouteBuilder(new FileConsumerRoute("FOO", 100)); main.run(); }
@Override public void configure() throws Exception { // read files from the shared directory from("file:target/inbox" + "?delete=true" + "&readLock=idempotent" + // use idempotent read lock "&idempotentRepository=#myRepo" + // refer to the idempotent repository "&readLockLoggingLevel=WARN" + // logging level, you can set this to DEBUG/OFF for production "&shuffle=true") // sort the files by random to reduce the chance of multiple nodes trying to process the same file .log(name + " - Received file: ${file:name}") .delay(delay) .log(name + " - Done file: ${file:name}") .to("file:target/outbox"); }
public void boot() throws Exception { main = new Main(); // the default zookeeper url is localhost:2181 MasterComponent master = new MasterComponent(); master.setZooKeeperUrl("localhost:2181"); main.bind("zookeeper-master", master); // add the route and and let the route be named Bar and use a little delay when processing the files main.addRouteBuilder(new FileConsumerRoute("Bar", 200)); main.run(); }
@Override public void configure() throws Exception { // read files from the shared directory from("file:target/inbox" + "?delete=true") // setup route policy to be used .routePolicyRef("myPolicy") .log(name + " - Received file: ${file:name}") .delay(delay) .log(name + " - Done file: ${file:name}") .to("file:target/outbox"); }
public void boot() throws Exception { main = new Main(); // the default zookeeper url is localhost:2181 MasterComponent master = new MasterComponent(); master.setZooKeeperUrl("localhost:2181"); main.bind("zookeeper-master", master); // add the route and and let the route be named Bar and use a little delay when processing the files main.addRouteBuilder(new FileConsumerRoute("Foo", 200)); main.run(); }
@Override public void configure() throws Exception { // read files from the shared directory from("file:target/inbox" + "?delete=true") // setup route policy to be used .routePolicyRef("myPolicy") .log(name + " - Received file: ${file:name}") .delay(delay) .log(name + " - Done file: ${file:name}") .to("file:target/outbox"); }
public void boot() throws Exception { // setup the hazelcast route policy ConsulRoutePolicy routePolicy = new ConsulRoutePolicy(); // the service names must be same in the foo and bar server routePolicy.setServiceName("myLock"); routePolicy.setTtl(5); main = new Main(); // bind the hazelcast route policy to the name myPolicy which we refer to from the route main.bind("myPolicy", routePolicy); // add the route and and let the route be named Bar and use a little delay when processing the files main.addRouteBuilder(new FileConsumerRoute("Foo", 100)); main.run(); }
@Override public void configure() throws Exception { // read files from the shared directory from("file:target/inbox" + "?delete=true") // setup route policy to be used .routePolicyRef("myPolicy") .log(name + " - Received file: ${file:name}") .delay(delay) .log(name + " - Done file: ${file:name}") .to("file:target/outbox"); }
public void boot() throws Exception { main = new Main(); // the default zookeeper url is localhost:2181 MasterRoutePolicy master = new MasterRoutePolicy(); master.setZooKeeperUrl("localhost:2181"); master.setGroupName("myGroup"); main.bind("zookeeper-master-policy", master); // add the route and and let the route be named Bar and use a little delay when processing the files main.addRouteBuilder(new FileConsumerRoute("Foo", 200)); main.run(); }
@Override public void configure() throws Exception { // read files from the shared directory // its import to set the route to not auto startup // as we let the route policy start/stop the routes when it becomes a master/slave etc from("file:target/inbox?delete=true").noAutoStartup() // use the zookeeper master route policy in the clustered group // to run this route in master/slave mode .routePolicyRef("zookeeper-master-policy") .log(name + " - Received file: ${file:name}") .delay(delay) .log(name + " - Done file: ${file:name}") .to("file:target/outbox"); }
public void boot() throws Exception { main = new Main(); // the default zookeeper url is localhost:2181 MasterRoutePolicy master = new MasterRoutePolicy(); master.setZooKeeperUrl("localhost:2181"); master.setGroupName("myGroup"); main.bind("zookeeper-master-policy", master); // add the route and and let the route be named Bar and use a little delay when processing the files main.addRouteBuilder(new FileConsumerRoute("Bar", 200)); main.run(); }
public void boot() throws Exception { // setup the hazelcast route policy ConsulRoutePolicy routePolicy = new ConsulRoutePolicy(); // the service names must be same in the foo and bar server routePolicy.setServiceName("myLock"); routePolicy.setTtl(5); main = new Main(); // bind the hazelcast route policy to the name myPolicy which we refer to from the route main.bind("myPolicy", routePolicy); // add the route and and let the route be named Bar and use a little delay when processing the files main.addRouteBuilder(new FileConsumerRoute("Bar", 100)); main.run(); }
public void boot() throws Exception { // create and embed the hazelcast server // (you can use the hazelcast client if you want to connect to external hazelcast server) HazelcastInstance hz = Hazelcast.newHazelcastInstance(); // setup the hazelcast route policy HazelcastRoutePolicy routePolicy = new HazelcastRoutePolicy(hz); // the lock names must be same in the foo and bar server routePolicy.setLockMapName("myLock"); routePolicy.setLockKey("myLockKey"); routePolicy.setLockValue("myLockValue"); // attempt to grab lock every 5th second routePolicy.setTryLockTimeout(5, TimeUnit.SECONDS); main = new Main(); // bind the hazelcast route policy to the name myPolicy which we refer to from the route main.bind("myPolicy", routePolicy); // add the route and and let the route be named Bar and use a little delay when processing the files main.addRouteBuilder(new FileConsumerRoute("Bar", 100)); main.run(); }
public void boot() throws Exception { // create and embed the hazelcast server // (you can use the hazelcast client if you want to connect to external hazelcast server) HazelcastInstance hz = Hazelcast.newHazelcastInstance(); // setup the hazelcast route policy HazelcastRoutePolicy routePolicy = new HazelcastRoutePolicy(hz); // the lock names must be same in the foo and bar server routePolicy.setLockMapName("myLock"); routePolicy.setLockKey("myLockKey"); routePolicy.setLockValue("myLockValue"); // attempt to grab lock every 5th second routePolicy.setTryLockTimeout(5, TimeUnit.SECONDS); main = new Main(); // bind the hazelcast route policy to the name myPolicy which we refer to from the route main.bind("myPolicy", routePolicy); // add the route and and let the route be named Bar and use a little delay when processing the files main.addRouteBuilder(new FileConsumerRoute("Foo", 100)); main.run(); }
main.addRouteBuilder(new FileConsumerRoute("Foo", 100)); main.run();
main.addRouteBuilder(new FileConsumerRoute("Bar", 100)); main.run();