1

I am trying to use camel-sql component with the option of useIterator=true but the result still gets loaded in one single big list. I have 2 million records to be processed and getting the resultset in one list is not an option. Below is the route configuration:

<route id="sql_route">
    <from uri="activemq:MW_SQL"/>
    <to uri="sql:SELECT ID, MSGID_PROD FROM amq.activemq_msgs?useIterator=true"/>
    <log message="This data is = ${body}"/>
</route>

From sourcecode it is clear that camel takes the whole resultset in list and then creates iterator of the same. Wrong design.

1 Answers1

0

The option useIterator is only for the consumer, eg when you use sql in the <from>. The sql component on the producer side do not support a iterative based.

You can use the JDBC component instead that supports this by setting OutputType=StreamList: http://camel.apache.org/jdbc

I logged a ticket to add support for this in the future in the SQL component: https://issues.apache.org/jira/browse/CAMEL-9849

Claus Ibsen
  • 56,060
  • 7
  • 50
  • 65