camel jdbc and splitter

View: New views
5 Messages — Rating Filter:   Alert me  

camel jdbc and splitter

by marcin80 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

I have a problem with splitting of a message returned by jdbc component. Jdbc component returns ArrayList<HashMap<String, Object>> but when I want to split it, splitter don't split this list and returns it without changing. I expected that splitter returns all list's elements seperately.
So, how can I split of result of jdbc component? I need run some logic for every row returned from database and I don't know how can I do it?

Thanks,
Marcin

Re: camel jdbc and splitter

by Claus Ibsen-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Fri, Nov 6, 2009 at 1:58 PM, marcin80 <mtroscia@...> wrote:

>
> Hi,
>
> I have a problem with splitting of a message returned by jdbc component.
> Jdbc component returns ArrayList<HashMap<String, Object>> but when I want to
> split it, splitter don't split this list and returns it without changing. I
> expected that splitter returns all list's elements seperately.
> So, how can I split of result of jdbc component? I need run some logic for
> every row returned from database and I don't know how can I do it?
>

Can you show the route ?

Usually in Java DSL you just do

from("jdbc:xxx").split(body()).to("yyyy");



> Thanks,
> Marcin
> --
> View this message in context: http://old.nabble.com/camel-jdbc-and-splitter-tp26230505p26230505.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>
>



--
Claus Ibsen
Apache Camel Committer

Author of Camel in Action: http://www.manning.com/ibsen/
Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/
Twitter: http://twitter.com/davsclaus

Re: camel jdbc and splitter

by marcin80 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

Thanks for your help. I have other question. How shoud I do it in XML? My Java DSL code looks like this:

from("timer:foo?period=5000").
                setBody(constant("select dz.xx from table dz")).
                to("jdbc:dataSource").splitter(body()).convertBodyTo(String.class).
                to("stream:out");

And I would like do it in XML:

<camel:route>
     <camel:from uri="timer:foo?period=5000"/>
     <camel:setBody>
          <camel:constant>
                select dz.xx from table dz
          </camel:constant>
     </camel:setBody>
     <camel:to uri="jdbc:dataSource"/>
          <camel:splitter>

                <!-- what shoud I use in this place -->
                               
                <camel:to uri="stream:out"/>
          </camel:splitter>
</camel:route>

Thanks,
Marcin


Claus Ibsen-2 wrote:
On Fri, Nov 6, 2009 at 1:58 PM, marcin80 <mtroscia@gmail.com> wrote:
>
> Hi,
>
> I have a problem with splitting of a message returned by jdbc component.
> Jdbc component returns ArrayList<HashMap<String, Object>> but when I want to
> split it, splitter don't split this list and returns it without changing. I
> expected that splitter returns all list's elements seperately.
> So, how can I split of result of jdbc component? I need run some logic for
> every row returned from database and I don't know how can I do it?
>

Can you show the route ?

Usually in Java DSL you just do

from("jdbc:xxx").split(body()).to("yyyy");



> Thanks,
> Marcin
> --
> View this message in context: http://old.nabble.com/camel-jdbc-and-splitter-tp26230505p26230505.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>
>



--
Claus Ibsen
Apache Camel Committer

Author of Camel in Action: http://www.manning.com/ibsen/
Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/
Twitter: http://twitter.com/davsclaus

Re: camel jdbc and splitter

by Claus Ibsen-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Mon, Nov 9, 2009 at 10:26 AM, marcin80 <mtroscia@...> wrote:

>
> Hi,
>
> Thanks for your help. I have other question. How shoud I do it in XML? My
> Java DSL code looks like this:
>
> from("timer:foo?period=5000").
>                setBody(constant("select dz.xx from table dz")).
>                to("jdbc:dataSource").splitter(body()).convertBodyTo(String.class).
>                to("stream:out");
>
> And I would like do it in XML:
>
> <camel:route>
>     <camel:from uri="timer:foo?period=5000"/>
>     <camel:setBody>
>          <camel:constant>
>                select dz.xx from table dz
>          </camel:constant>
>     </camel:setBody>
>     <camel:to uri="jdbc:dataSource"/>
>          <camel:splitter>
>
>                <!-- what shoud I use in this place -->
>

Hi

Yeah the XML is not a programming language so something is not yet
easily possible.
I think we should add a option on the JDBC component so it can emit
splitted rows for you.

Please create a ticket in JIRA about this then we can fix it in the
JDBC / SQL components.

Otherwise you need to use a <method ref="bean" method="foo"/> And have
some java code doing the splitting.

>                <camel:to uri="stream:out"/>
>          </camel:splitter>
> </camel:route>
>
> Thanks,
> Marcin
>
>
>
> Claus Ibsen-2 wrote:
>>
>> On Fri, Nov 6, 2009 at 1:58 PM, marcin80 <mtroscia@...> wrote:
>>>
>>> Hi,
>>>
>>> I have a problem with splitting of a message returned by jdbc component.
>>> Jdbc component returns ArrayList<HashMap<String, Object>> but when I want
>>> to
>>> split it, splitter don't split this list and returns it without changing.
>>> I
>>> expected that splitter returns all list's elements seperately.
>>> So, how can I split of result of jdbc component? I need run some logic
>>> for
>>> every row returned from database and I don't know how can I do it?
>>>
>>
>> Can you show the route ?
>>
>> Usually in Java DSL you just do
>>
>> from("jdbc:xxx").split(body()).to("yyyy");
>>
>>
>>
>>> Thanks,
>>> Marcin
>>> --
>>> View this message in context:
>>> http://old.nabble.com/camel-jdbc-and-splitter-tp26230505p26230505.html
>>> Sent from the Camel - Users mailing list archive at Nabble.com.
>>>
>>>
>>
>>
>>
>> --
>> Claus Ibsen
>> Apache Camel Committer
>>
>> Author of Camel in Action: http://www.manning.com/ibsen/
>> Open Source Integration: http://fusesource.com
>> Blog: http://davsclaus.blogspot.com/
>> Twitter: http://twitter.com/davsclaus
>>
>>
>
> --
> View this message in context: http://old.nabble.com/camel-jdbc-and-splitter-tp26230505p26263321.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>
>



--
Claus Ibsen
Apache Camel Committer

Author of Camel in Action: http://www.manning.com/ibsen/
Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/
Twitter: http://twitter.com/davsclaus

Re: camel jdbc and splitter

by Claus Ibsen-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi

I have created a ticket
https://issues.apache.org/activemq/browse/CAMEL-2163

To add a option on the endpoint so its easier to do in Spring XML also.


On Mon, Nov 9, 2009 at 7:48 PM, Claus Ibsen <claus.ibsen@...> wrote:

> On Mon, Nov 9, 2009 at 10:26 AM, marcin80 <mtroscia@...> wrote:
>>
>> Hi,
>>
>> Thanks for your help. I have other question. How shoud I do it in XML? My
>> Java DSL code looks like this:
>>
>> from("timer:foo?period=5000").
>>                setBody(constant("select dz.xx from table dz")).
>>                to("jdbc:dataSource").splitter(body()).convertBodyTo(String.class).
>>                to("stream:out");
>>
>> And I would like do it in XML:
>>
>> <camel:route>
>>     <camel:from uri="timer:foo?period=5000"/>
>>     <camel:setBody>
>>          <camel:constant>
>>                select dz.xx from table dz
>>          </camel:constant>
>>     </camel:setBody>
>>     <camel:to uri="jdbc:dataSource"/>
>>          <camel:splitter>
>>
>>                <!-- what shoud I use in this place -->
>>
>
> Hi
>
> Yeah the XML is not a programming language so something is not yet
> easily possible.
> I think we should add a option on the JDBC component so it can emit
> splitted rows for you.
>
> Please create a ticket in JIRA about this then we can fix it in the
> JDBC / SQL components.
>
> Otherwise you need to use a <method ref="bean" method="foo"/> And have
> some java code doing the splitting.
>
>>                <camel:to uri="stream:out"/>
>>          </camel:splitter>
>> </camel:route>
>>
>> Thanks,
>> Marcin
>>
>>
>>
>> Claus Ibsen-2 wrote:
>>>
>>> On Fri, Nov 6, 2009 at 1:58 PM, marcin80 <mtroscia@...> wrote:
>>>>
>>>> Hi,
>>>>
>>>> I have a problem with splitting of a message returned by jdbc component.
>>>> Jdbc component returns ArrayList<HashMap<String, Object>> but when I want
>>>> to
>>>> split it, splitter don't split this list and returns it without changing.
>>>> I
>>>> expected that splitter returns all list's elements seperately.
>>>> So, how can I split of result of jdbc component? I need run some logic
>>>> for
>>>> every row returned from database and I don't know how can I do it?
>>>>
>>>
>>> Can you show the route ?
>>>
>>> Usually in Java DSL you just do
>>>
>>> from("jdbc:xxx").split(body()).to("yyyy");
>>>
>>>
>>>
>>>> Thanks,
>>>> Marcin
>>>> --
>>>> View this message in context:
>>>> http://old.nabble.com/camel-jdbc-and-splitter-tp26230505p26230505.html
>>>> Sent from the Camel - Users mailing list archive at Nabble.com.
>>>>
>>>>
>>>
>>>
>>>
>>> --
>>> Claus Ibsen
>>> Apache Camel Committer
>>>
>>> Author of Camel in Action: http://www.manning.com/ibsen/
>>> Open Source Integration: http://fusesource.com
>>> Blog: http://davsclaus.blogspot.com/
>>> Twitter: http://twitter.com/davsclaus
>>>
>>>
>>
>> --
>> View this message in context: http://old.nabble.com/camel-jdbc-and-splitter-tp26230505p26263321.html
>> Sent from the Camel - Users mailing list archive at Nabble.com.
>>
>>
>
>
>
> --
> Claus Ibsen
> Apache Camel Committer
>
> Author of Camel in Action: http://www.manning.com/ibsen/
> Open Source Integration: http://fusesource.com
> Blog: http://davsclaus.blogspot.com/
> Twitter: http://twitter.com/davsclaus
>



--
Claus Ibsen
Apache Camel Committer

Author of Camel in Action: http://www.manning.com/ibsen/
Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/
Twitter: http://twitter.com/davsclaus
Need professional support or training for Apache Camel? Graphic Design by Hiram and the Nabble Forum configured by James