@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"); }
@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"); }
@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"); }
@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"); }
@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"); }
@Override public void configure() throws Exception { // add dropwizard metrics to all our routes getContext().addRoutePolicyFactory(new MetricsRoutePolicyFactory()); from("timer:foo").id("foo") .delay(simple("${random(0,1000)}")) .log("Foo is done"); from("timer:bar").id("bar") .delay(simple("${random(0,5000)}")) .log("Bar is done"); } }
@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"); }
.log(DEBUG, pluginId + " delayed ${exchangeId} ${in.header.bodyClass}, correlationKey: ${in.header.correlationKey}")) .to(endpoints.getConsumerUri());