Versions Compared

Key

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

...

This feature also appears frequently. In the try...catch DSL or onException DSL, we may use some external or custom exception classes. But current groovy renderer doesn't process the import packages, so if you should manually add the import lines each time you edit it. Another problem is that groovy renderer can't return the instance name of that class. For example, you may define a route like:

...

  • happen to: doTry...doCatch(...doFinally), onException, throwException, pollEnrich, process, etc.
  • improving suggestion: let groovy renderer add the import packages automatically, but I am afraid it can't process them at all times.

Filter and When DSL in Groovy style

The Web Console parses routes in groovy language by using the GroovyRouteBuilder in camel-groovy component. GroovyRouteBuilder uses the ConfigureCamel to dynamically add methods for the route configuration behaviors. Currently it has added closure for filter and when DSL. So you can use two method to defined a filter through Web Console:

Code Block

from("direct:start").filter(header("foo").isEqualTo("bar")).to("mock:result")

or

Code Block

from("direct:start").filter {e -> e.in.headers.foo == "bar"}.to("mock:result")

However, groovy renderer can only render the first filter because a closure is unreadable in Camel Context.

other features

Some expression and predicate have complex and refractory toString method, so the ExpressionRenderer and PredicateRenderer class written a little hard.