Versions Compared

Key

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

XQuery

Camel supports XQuery to allow an Expression or Predicate to be used in the DSL or Xml Configuration. For example you could use XQuery to create an Predicate in a Message Filter or as an Expression for a Recipient List.

To add an XQuery expression to your routing rules its usually easiest to import the XQueryBuilder classes methods then you can use the xquery() function inside your rules.

Code Block
import static org.apache.camel.builder.saxon.XQueryBuilder.*;

...


from("queue:foo").filter(xquery("//foo")).to("queue:bar")

Examples

Here is a simple example using an XQuery expression as a predicate in a Message Filter

Wiki Markup
{snippet:id=example|lang=java|url=activemq/camel/trunk/components/camel-saxon/src/test/java/org/apache/camel/builder/saxon/XQueryFilterTest.java}