How can I split a ArrayList object using .splitter(body()) ?

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

How can I split a ArrayList object using .splitter(body()) ?

by cmoulliard :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

I would like to know how I can split the content of "Products" ArrayList into different messages (one by Product class by example) using splitter ?

.splitter(body() ......

Regards,

Charles Moulliard

Enterprise Architect

Xpectis
12, route d'Esch
L-1470 Luxembourg

Phone +352 25 10 70 470
Mobile +352 621 45 36 22

e-mail : cmoulliard@xpectis.com
web site : www.xpectis.com
My Blog : http://cmoulliard.blogspot.com/ 

Re: How can I split a ArrayList object using .splitter(body()) ?

by cmoulliard :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Apparently, using this

.splitter(body))

will split extract each Product object from the Product ArrayList.

cmoulliard wrote:
Hi,

I would like to know how I can split the content of "Products" ArrayList into different messages (one by Product class by example) using splitter ?

.splitter(body() ......

Regards,

Charles Moulliard
Enterprise Architect

Xpectis
12, route d'Esch
L-1470 Luxembourg

Phone +352 25 10 70 470
Mobile +352 621 45 36 22

e-mail : cmoulliard@xpectis.com
web site : www.xpectis.com
My Blog : http://cmoulliard.blogspot.com/ 

Re: How can I split a ArrayList object using .splitter(body()) ?

by David Siefert-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I would like to do something similar, but I would like to accomplish this
using XML.  Based on another message related to splitting a message, James
mentioned the use of Bean Integration.  Looking in the XML schema for 1.4.0
I also found splitter had support for expressionNode type which allows you
to use XPath, a method call (related to bean integration), el, javascript,
and simple.  So I am trying to put 2+2 together to come up with a solution.
I'm thinking something like:

<route>
  <from uri="direct:incoming" />
  <splitter>
    <simple>body</simple>
    <to uri="direct:outgoing" />
  </splitter>
</route>
So it will take a message, split on the body (which is already
Iterable--since it will receive an ArrayList), and send each part to the
next processor.  Has anybody already done this--or know if it works?  I'll
post a test if I can get a chance to take a stab at this tommorow...

-David
On Fri, Jul 18, 2008 at 9:45 AM, cmoulliard <cmoulliard@...> wrote:

>
> Apparently, using this
>
> .splitter(body))
>
> will split extract each Product object from the Product ArrayList.
>
>
> cmoulliard wrote:
> >
> > Hi,
> >
> > I would like to know how I can split the content of "Products" ArrayList
> > into different messages (one by Product class by example) using splitter
> ?
> >
> > .splitter(body() ......
> >
> > Regards,
> >
> > Charles Moulliard
> >
> >
> >
>
>
> -----
> Enterprise Architect
>
> Xpectis
> 12, route d'Esch
> L-1470 Luxembourg
>
> Phone +352 25 10 70 470
> Mobile +352 621 45 36 22
>
> e-mail : cmoulliard@...
> web site : www.xpectis.com
> --
> View this message in context:
> http://www.nabble.com/How-can-I-split-a-ArrayList-object-using-.splitter%28body%28%29%29---tp18524380s22882p18530894.html
>  Sent from the Camel - Users mailing list archive at Nabble.com.
>
>

Re: How can I split a ArrayList object using .splitter(body()) ?

by James.Strachan :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

It should work : ) let us know if you get around to creating a test
case and we can add to the distro

2008/8/20 David Siefert <siefert.david.mailinglist@...>:

> I would like to do something similar, but I would like to accomplish this
> using XML.  Based on another message related to splitting a message, James
> mentioned the use of Bean Integration.  Looking in the XML schema for 1.4.0
> I also found splitter had support for expressionNode type which allows you
> to use XPath, a method call (related to bean integration), el, javascript,
> and simple.  So I am trying to put 2+2 together to come up with a solution.
> I'm thinking something like:
>
> <route>
>  <from uri="direct:incoming" />
>  <splitter>
>    <simple>body</simple>
>    <to uri="direct:outgoing" />
>  </splitter>
> </route>
> So it will take a message, split on the body (which is already
> Iterable--since it will receive an ArrayList), and send each part to the
> next processor.  Has anybody already done this--or know if it works?  I'll
> post a test if I can get a chance to take a stab at this tommorow...
>
> -David
> On Fri, Jul 18, 2008 at 9:45 AM, cmoulliard <cmoulliard@...> wrote:
>
>>
>> Apparently, using this
>>
>> .splitter(body))
>>
>> will split extract each Product object from the Product ArrayList.
>>
>>
>> cmoulliard wrote:
>> >
>> > Hi,
>> >
>> > I would like to know how I can split the content of "Products" ArrayList
>> > into different messages (one by Product class by example) using splitter
>> ?
>> >
>> > .splitter(body() ......
>> >
>> > Regards,
>> >
>> > Charles Moulliard
>> >
>> >
>> >
>>
>>
>> -----
>> Enterprise Architect
>>
>> Xpectis
>> 12, route d'Esch
>> L-1470 Luxembourg
>>
>> Phone +352 25 10 70 470
>> Mobile +352 621 45 36 22
>>
>> e-mail : cmoulliard@...
>> web site : www.xpectis.com
>> --
>> View this message in context:
>> http://www.nabble.com/How-can-I-split-a-ArrayList-object-using-.splitter%28body%28%29%29---tp18524380s22882p18530894.html
>>  Sent from the Camel - Users mailing list archive at Nabble.com.
>>
>>
>



--
James
-------
http://macstrac.blogspot.com/

Open Source Integration
http://open.iona.com

Re: How can I split a ArrayList object using .splitter(body()) ?

by Doug Douglass-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

David,

Just last week I was searching around for a solution to the same problem.
Here's basically what I ended up with using Juel:

<route>
  <from uri="seda:a" />
  <splitter>
    <el>${in.body}</el>
    <to uri="seda:b" />
  </splitter>
</route>

In our case, seda:a contains the results of a jdbc component, so it's an
Iterable List. It's working well in testing, though our expectations are for
a relatively low volume of messages.

HTH,
Doug

On Wed, Aug 20, 2008 at 2:16 AM, James Strachan <james.strachan@...>wrote:

> It should work : ) let us know if you get around to creating a test
> case and we can add to the distro
>
> 2008/8/20 David Siefert <siefert.david.mailinglist@...>:
> > I would like to do something similar, but I would like to accomplish this
> > using XML.  Based on another message related to splitting a message,
> James
> > mentioned the use of Bean Integration.  Looking in the XML schema for
> 1.4.0
> > I also found splitter had support for expressionNode type which allows
> you
> > to use XPath, a method call (related to bean integration), el,
> javascript,
> > and simple.  So I am trying to put 2+2 together to come up with a
> solution.
> > I'm thinking something like:
> >
> > <route>
> >  <from uri="direct:incoming" />
> >  <splitter>
> >    <simple>body</simple>
> >    <to uri="direct:outgoing" />
> >  </splitter>
> > </route>
> > So it will take a message, split on the body (which is already
> > Iterable--since it will receive an ArrayList), and send each part to the
> > next processor.  Has anybody already done this--or know if it works?
>  I'll
> > post a test if I can get a chance to take a stab at this tommorow...
> >
> > -David
> > On Fri, Jul 18, 2008 at 9:45 AM, cmoulliard <cmoulliard@...>
> wrote:
> >
> >>
> >> Apparently, using this
> >>
> >> .splitter(body))
> >>
> >> will split extract each Product object from the Product ArrayList.
> >>
> >>
> >> cmoulliard wrote:
> >> >
> >> > Hi,
> >> >
> >> > I would like to know how I can split the content of "Products"
> ArrayList
> >> > into different messages (one by Product class by example) using
> splitter
> >> ?
> >> >
> >> > .splitter(body() ......
> >> >
> >> > Regards,
> >> >
> >> > Charles Moulliard
> >> >
> >> >
> >> >
> >>
> >>
> >> -----
> >> Enterprise Architect
> >>
> >> Xpectis
> >> 12, route d'Esch
> >> L-1470 Luxembourg
> >>
> >> Phone +352 25 10 70 470
> >> Mobile +352 621 45 36 22
> >>
> >> e-mail : cmoulliard@...
> >> web site : www.xpectis.com
> >> --
> >> View this message in context:
> >>
> http://www.nabble.com/How-can-I-split-a-ArrayList-object-using-.splitter%28body%28%29%29---tp18524380s22882p18530894.html
> >>  Sent from the Camel - Users mailing list archive at Nabble.com.
> >>
> >>
> >
>
>
>
> --
> James
> -------
> http://macstrac.blogspot.com/
>
> Open Source Integration
> http://open.iona.com
>
LightInTheBox - Buy quality products at wholesale price
Need professional support or training for Apache Camel? Graphic Design by Hiram and the Nabble Forum configured by James