2008/12/3 Claus Ibsen <[EMAIL PROTECTED]>:
> Hi
>
> Yeah simple does not understand EQ, GE, LT and other operators.
>
> You can use some of the other languages
> - ognl
> - el
> - groovy
> - bean (for using POJO)
> - xpath if your payload is xml based
>
> See
> http://activemq.apache.org/camel/scripting-languages.html
> http://activemq.apache.org/camel/ognl.html
>
> Using OGNL it would be
> <ognl>request.headers.foo = 'foo1'</ognl>
>
> But I am wondering if we should improve the simple language so it can
> be use some simple operators for simple test such as in your use-case.
> No need to learn OGNL, Groovy or depend on 3rd part .jars. Just plain Java.
>
> James, any thoughts on this?

If in doubt, just use a Java method to evaluate your expression...
http://cwiki.apache.org/CAMEL/bean-language.html

e.g.

public boolean isFoo1(@Header(name = "foo") String foo) {
  return foo.equals("foo1");
}

Or you could go one step further and write the router as a single Java method...
http://activemq.apache.org/camel/recipientlist-annotation.html

@RecipientList
public String myRouter(@Header(name="foo") String foo,
@Header(name="bar") Integer bar) {
  if (foo.equals("foo1") {
    return "ref:fooBean1";
  }
  ...
}

With any expressions its always worth writing some test cases to check
your expressions do what you expect...
http://cwiki.apache.org/CAMEL/testing.html

I'd also recommend turning on tracing to make absolutely sure the
messages look exactly as you think
http://activemq.apache.org/camel/tracer.html

-- 
James
-------
http://macstrac.blogspot.com/

Open Source Integration
http://fusesource.com/

Reply via email to