THIS IS A TEST INSTANCE. ALL YOUR CHANGES WILL BE LOST!!!!
...
Code Block | ||||
---|---|---|---|---|
| ||||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <route id="route1" xmlns:ns2="http://camel.apache.org/schema/web" xmlns="http://camel.apache.org/schema/spring"> <description>This is an example route which you can start, stop and modify</description> <from uri="seda:foo"/> <to uri="mock:results" id="to1"/> </route> |
The groovy renderer will translate it into a route definition as follows:
Code Block | ||||
---|---|---|---|---|
| ||||
import org.apache.camel.language.groovy.GroovyRouteBuilder; class GroovyRoute extends GroovyRouteBuilder { void configure() { from("seda:foo").to("mock:results") } } |
Then you can update the route by input DSLs into the configure method. For example, you can change it into a Content Based Router by updating it as follows.
Code Block | ||||
---|---|---|---|---|
| ||||
import org.apache.camel.language.groovy.GroovyRouteBuilder; class GroovyRoute extends GroovyRouteBuilder { void configure() { from("seda:a").choice().when(header("foo").isEqualTo("bar")).to("seda:b") .when(header("foo").isEqualTo("cheese")).to("seda:c").otherwise().to("seda:d") } } |
Save it and then the route will deliver the following messages by parsing its header.
...