Versions Compared

Key

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

...

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 SqlMapClient method to invoke. The enum values are: QueryForObject, QueryForList, Insert, Update, Delete, Default. Default uses the existing behavior as in Camel 1.x. See samples for more.

Message Headers

Camel will populate the result message, either IN or OUT with a header with the operationName used:

Header

Type

Description

org.apache.camel.ibatis.queryName

String

Camel 1.x: The operationName statementName used (for example: insertAccount)

CamelIBatisStatementName

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
java
java
from("timer://pollTheDatabase?delay=30000").to("ibatis:selectAllAccounts?statementType=QueryForList").to("activemq:queue:allAccounts");

...