Versions Compared

Key

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

...

Where operationName is the name in the iBATIS XML configuration file which maps to the query, insert, update or delete operation you wish to evaluate.

Options

...

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.

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 used (for example: insertAccount)

CamelIBatisStatementName

String

Camel 2.0: The operationName used (for example: insertAccount)

...

Code Block
xml
xml
  <!-- Select with no parameters using the result map for Account class. -->
  <select id="selectAllAccounts" resultMap="AccountResult">
    select * from ACCOUNT
  </select>

Using onConsume

This component supports executing statements after data have been consumed and processed by Camel. This allows you to do post updates in the database. Notice all statements must be UPDATE statements. Camel supports executing multiple statements whose name should be separated by comma.

The route below illustrates we execute the consumeAccount statement data is processed. This allows us to change the status of the row in the database to processed, so we avoid consuming it twice or more.
ID 1

And the statements in the sqlmap file:
ID 1
ID 2

Include Page
CAMEL:Endpoint See Also
CAMEL:Endpoint See Also