You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by focaldi <fe...@tav.aero> on 2011/12/02 11:02:54 UTC

How can I split resultset that come from database?

Hi, I am trying to split a resultset. My Route runs a select sql in database
after that it will send all resultset in a message. But I need to split the
resultset and send to queue row by row. Ho can I do this? Thanks all

--
View this message in context: http://camel.465427.n5.nabble.com/How-can-I-split-resultset-that-come-from-database-tp5041311p5041311.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: How can I split resultset that come from database?

Posted by focaldi <fe...@tav.aero>.
Thanks my friend, I use "myroute.split(body())" and it works. Thanks both of
you...

--
View this message in context: http://camel.465427.n5.nabble.com/How-can-I-split-resultset-that-come-from-database-tp5041311p5041487.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: How can I split resultset that come from database?

Posted by Claus Ibsen <cl...@gmail.com>.
On Fri, Dec 2, 2011 at 11:36 AM, Christian Müller
<ch...@gmail.com> wrote:
> Use "split(body())".
>

Yes this will work if the message body is Iterateable, such as a
Collection, Array, List etc.

However if the body is a pure javax.sql.ResultSet then that API is not
iterateable.

You could add a custom type converter from ResultSet -> Iterator
And then implement the logic there, and also implement the Closeable
interface, and close the resultset on the close() method.
The Camel splitter supports the Closeable interface.



> Best,
> Christian
>
> On Fri, Dec 2, 2011 at 11:02 AM, focaldi <fe...@tav.aero> wrote:
>
>> Hi, I am trying to split a resultset. My Route runs a select sql in
>> database
>> after that it will send all resultset in a message. But I need to split the
>> resultset and send to queue row by row. Ho can I do this? Thanks all
>>
>> --
>> View this message in context:
>> http://camel.465427.n5.nabble.com/How-can-I-split-resultset-that-come-from-database-tp5041311p5041311.html
>> Sent from the Camel - Users mailing list archive at Nabble.com.
>>



-- 
Claus Ibsen
-----------------
FuseSource
Email: cibsen@fusesource.com
Web: http://fusesource.com
Twitter: davsclaus, fusenews
Blog: http://davsclaus.blogspot.com/
Author of Camel in Action: http://www.manning.com/ibsen/

Re: How can I split resultset that come from database?

Posted by Christian Müller <ch...@gmail.com>.
Use "split(body())".

Best,
Christian

On Fri, Dec 2, 2011 at 11:02 AM, focaldi <fe...@tav.aero> wrote:

> Hi, I am trying to split a resultset. My Route runs a select sql in
> database
> after that it will send all resultset in a message. But I need to split the
> resultset and send to queue row by row. Ho can I do this? Thanks all
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/How-can-I-split-resultset-that-come-from-database-tp5041311p5041311.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>