...
Option | Type | Default | Description |
---|---|---|---|
consumer.onConsume | String | null | Statements to run after consuming. Can be used to eg. update rows after they have been consumed and processed in Camel. See sample later. Multiple statements can be separated with comma. |
consumer.useIterator | Boolean | true | If true each row returned when polling will be processed individually. If false the entire List of data is set as the IN body. |
consumer.routeEmptyResultSet | Boolean | false | Camel 2.0: Sets whether empty resultset should be routed or not. By default empty result sets are not routed. |
statementType | StatementType | Default null | Camel 1.6.1/2.0: Used by the Mandatory to specify for IbatisProducer to control which iBatis |
Message Headers
Camel will populate the result message, either IN or OUT with a header with the operationName used:
Header | Type | Description |
---|---|---|
| String | Camel 1.x: The operationName statementName used (for example: insertAccount) |
| String | Camel 2.0: The operationName statementName used (for example: insertAccount) |
...
Code Block |
---|
from("activemq:queue:newAccount").
to("ibatis:insertAccount?statementType=Insert");
|
Notice we have to specify the statementType
, as we need to instruct Camel which SqlMapClient
operation to invoke.
Where insertAccount is the iBatis id in the SQL map file:
...
Using StatementType for better control of IBatis
Available as of Camel 1.6.1/2.0
When routing to an iBatis endpoint you want more fine grained control so you can control whether the SQL statement to be executed is a SELEECT, UPDATE, DELETE or INSERT etc. This is now possible in Camel 1.6.1/2.0. So for instance if we want to route to an iBatis endpoint in which the IN body contains parameters to a SELECT statement we can do:
...
Code Block | ||||
---|---|---|---|---|
| ||||
from("timer://pollTheDatabase?delay=30000").to("ibatis:selectAllAccounts?statementType=QueryForList").to("activemq:queue:allAccounts");
|
...