Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
java
java
import org.apache.camel.language.groovy.GroovyRouteBuilder;
class GroovyRoute extends GroovyRouteBuilder {
    void configure() {
        from("seda:foo").to("mock:results")
    }
}

Then we can update the route by input new DSL into the configure method. For example, we can change it into a Content Based Router by updating it as follows.

Code Block
java
java

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 the route will deliver the following messages by parsing its header. Though the groovy renderer can accept all kinds of DSLs, but it can't render every details of the route when opening it.