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

Camel 2.0: Used by the IbatisProducer to control which iBatis SqlMapClient method to invoke. The enum values are: QueryForObject, QueryForList, Insert, Update, Delete, Default. See samples for more.

Message Headers

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

...

Code Block
xml
xml
  <!-- Insert example, using the Account parameter class -->
  <insert id="insertAccount" parameterClass="Account">
    insert into ACCOUNT (
      ACC_ID,
      ACC_FIRST_NAME,
      ACC_LAST_NAME,
      ACC_EMAIL
    )
    values (
      #id#, #firstName#, #lastName#, #emailAddress#
    )
  </insert>

Using StatementType for better control of IBatis

Available as of Camel 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 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:

Wiki Markup
{snippet:id=e1|lang=java|url=camel/trunk/components/camel-ibatis/src/test/java/org/apache/camel/component/ibatis/IBatisQueryForObjectTest.java}

In the code above we can invoke the iBatis statement selectAccountById and the IN body should contain the account id we want to retrieve.

We can do the same for some of the other operations, such as QueryForList:

Wiki Markup
{snippet:id=e1|lang=java|url=camel/trunk/components/camel-ibatis/src/test/java/org/apache/camel/component/ibatis/IBatisQueryForListTest.java}

And the same for UPDATE, where we can send an Account object as IN body to iBatis:

Wiki Markup
{snippet:id=e1|lang=java|url=camel/trunk/components/camel-ibatis/src/test/java/org/apache/camel/component/ibatis/IBatisQueryForUpdateTest.java}

Scheduled polling example

...