You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 2 Next »

SQL

The SQL support is added by JoSQL and is primarily used for performing SQL queries on in-memory objects. If you prefer to perform actual database queries then check out the JPA component.

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

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

import static org.apache.camel.builder.sql.SqlBuilder.*;

...


from("queue:foo").setBody(sql("select * from MyType")).to("queue:bar")
  • No labels