Skip to content

Instantly share code, notes, and snippets.

@hpirosha
Created December 4, 2012 11:53
Show Gist options
  • Save hpirosha/4203018 to your computer and use it in GitHub Desktop.
Save hpirosha/4203018 to your computer and use it in GitHub Desktop.
demoOne_camel_java_dsl
package org.nsinfra.camel;
import org.apache.camel.CamelContext;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.impl.DefaultCamelContext;
public class JavaDSLMain extends RouteBuilder {
/**
* {@link RouteBuilder#configure()}
* Specifies route definition
*/
@Override
public void configure() throws Exception {
from("activemq:queue:NewOrders?brokerURL=tcp://192.168.64.144:61616")
.choice().when(xpath("/order/product = 'gadget'"))
.to("activemq:queue:GadgetOrders?brokerURL=tcp://192.168.64.144:61616")
.otherwise()
.to("ftp://192.168.101.3/camel-demo?username=admin&password=admin&binary=true");
}
public static void main(String[] args) throws Exception {
CamelContext camelContext = new DefaultCamelContext();
camelContext.addRoutes(new JavaDSLMain());
camelContext.start();
/* wait indefinitely */
Object obj = new Object();
synchronized (obj) {
obj.wait();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment