The SQL support is added by JoSQL(http://josql.sourceforge.net/)
and is primarily used for performing SQL queries on in-memory objects. The SQL support is
part of the camel-josql module.
To use Ruby in your routes you need to add a dependency on
camel-josql to your project as shown in
Example 15.1.
Example 15.1. Adding the camel-script dependency
<!-- Maven POM File -->
...
<dependencies>
...
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-josql</artifactId>
<version>${camel-version}</version>
</dependency>
...
</dependencies>Table 15.1 lists the variables that are accessible when using SQL.
Table 15.1. SQL variables
| Name | Type | Description |
|---|---|---|
exchange | org.apache.camel.Exchange | The current Exchange |
in | org.apache.camel.Message | The IN message |
out | org.apache.camel.Message | The OUT message |
property | Object | the Exchange property whose key is property |
header | Object | the IN message header whose key is header |
variable | Object | the variable whose key is variable |
Example 15.2 shows a route that uses SQL.
Example 15.2. Route using SQL
<camelContext>
<route>
<from uri="direct:start"/>
<setBody>
<langauge langauge="sql">select * from MyType</langauge>
</setBody>
<to uri="seda:regularQueue"/>
</route>
</camelContext>






