Aggregating from a loop

2022-05-05 Thread Meeraj Kunnumpurath
Hi,

I have a need to invoke multiple endpoints from a loop and then aggregate the 
results and return that to a caller. I tried using multicast with a predefined 
set of endpoints, and I can get it working with an aggregation strategy. Since 
the endpoints are dynamic, I switched to using a loop, however, it seems to be 
returning the result of only the last invocation. The route definition is shown 
below.






http://camel.apache.org/schema/spring";>





2







Kind regards
Meeraj
The information transmitted, including any content in this communication is 
confidential, is intended only for the use of the intended recipient and is the 
property of the Western Union Company or its affiliates and subsidiaries. If 
you are not the intended recipient, you are hereby notified that any use of the 
information contained in or transmitted with the communication or 
dissemination, distribution, or copying of this communication is strictly 
prohibited. If you have received this communication in error, please notify the 
Western Union sender immediately by replying to this message and delete the 
original message


Custom Transformation

2012-05-02 Thread Meeraj Kunnumpurath
Hi,

I have a need to apply custom transformation using a third party library.
My plan is to write a new data format. However, I am not sure whether it is
the right component for me, as the need is to have one transform method,
which doesn't fit well with the marshal/unmarshal pair.

A second question I have on this is once I have defined the component, how
do I integrate that into the Spring DSL. With a custom data format, I ran
into the following problems ..

1. Since the JAXB context used by loadRouteDefinitions has hard-wired the
packages it recognizes, I am unable to introduce any new vocabulary into
the DSL
2. If I override loadRouteDefinitions to recognize my packages, some of the
types like UnmarshalDefinition within Camel are constrained in terms of the
types of children it can have. So I am unable to introduce any new types in
there.

Kind regards
Meeraj


Re: Custom Transformation

2012-05-02 Thread Meeraj Kunnumpurath
Thanks Claus.

So do I defined the custom data format as a Spring bean refer to it from
the unmarshal XML element. Or do I need to use setDataFormatResolver on
CamelContext?

Thanks
Meeraj

PS: BTW just got the book, it rocks :)

On Wed, May 2, 2012 at 1:44 PM, Claus Ibsen  wrote:

> On Wed, May 2, 2012 at 12:04 PM, Meeraj Kunnumpurath
>  wrote:
> > Hi,
> >
> > I have a need to apply custom transformation using a third party library.
> > My plan is to write a new data format. However, I am not sure whether it
> is
> > the right component for me, as the need is to have one transform method,
> > which doesn't fit well with the marshal/unmarshal pair.
> >
>
> A data format dont have to support both. For example tiny markup only
> support one of them.
>
>
> > A second question I have on this is once I have defined the component,
> how
> > do I integrate that into the Spring DSL. With a custom data format, I ran
> > into the following problems ..
> >
> > 1. Since the JAXB context used by loadRouteDefinitions has hard-wired the
> > packages it recognizes, I am unable to introduce any new vocabulary into
> > the DSL
> > 2. If I override loadRouteDefinitions to recognize my packages, some of
> the
> > types like UnmarshalDefinition within Camel are constrained in terms of
> the
> > types of children it can have. So I am unable to introduce any new types
> in
> > there.
> >
>
> You can't. Although I think I have seen some ppl post about some hacks
> he did in the XML DSL to extend with custom namespaces.
> But its not easy thought. But maybe you can google that, if you really
> really want to go down that path.
>
> You can use a custom data format in the DSL, and just refer to that
> using the generic marshal / unmarshal.
>
>
> > Kind regards
> > Meeraj
>
>
>
> --
> Claus Ibsen
> -
> CamelOne 2012 Conference, May 15-16, 2012: http://camelone.com
> FuseSource
> Email: cib...@fusesource.com
> Web: http://fusesource.com
> Twitter: davsclaus, fusenews
> Blog: http://davsclaus.blogspot.com/
> Author of Camel in Action: http://www.manning.com/ibsen/
>



-- 
*Meeraj Kunnumpurath*
*Director and Executive Principal
Service Symphony Ltd
00 44 7702 693597
mee...@servicesymphony.com*


Re: Custom Transformation

2012-05-02 Thread Meeraj Kunnumpurath
I think it will be a good idea to relax the restrictions around how custom
vocabulary can be introduced into the XML based DSL. For example ability to
allow additional JAXB packages to be scanned for model definitions, and
also removing the restriction around data format definitions an unmarshal
definition is allowed to have. This will help custom formats to be made
configurable through XML vocabulary and JAXB binding rather that URIs.

Regards
Meeraj

On Wed, May 2, 2012 at 3:50 PM, Claus Ibsen  wrote:

> On Wed, May 2, 2012 at 4:36 PM, Raul Kripalani 
> wrote:
> > Just a quick comment. In my experience I have found data formats to fit
> in
> > well with the marshal / unmarshal model where there is a low-level data
> > format and a high-level object roundtrip, but not so well with high-level
> > ad-hoc transformations.
> >
> > If you look at the DataFormat interface, you'll see what I mean, as it's
> > tailored to handle InputStream and OutputStream.
> >
> > If your third party library doesn't handle Input/OutputStreams, maybe
> your
> > safest bet is to create a simple bean with a transform() method, and pass
> > in any runtime arguments as message headers.
> >
> > But then again, Claus is the God of Camel here and he knows better than
> me
> > ;)
> >
>
> Well one caveat with the data format is that you can't configure them
> using uris, as you can with endpoints.
> So eg a custom component with an endpoint can more easily be
> configured / customized in the routes.
>
> You can configure your data formats using the usual  style with
> the  style.
>
> We have talked about for Camel 3.x to allow configuring data formats
> with uris as well. But so far its not doable.
> So what we have to do for the out of the box data formats is to add
> options in the camel-core for the DSL, if we want
> to offer configuration from the DSL itself.
>
> And btw with data formats, sometimes you kinda forget what marshal and
> unarmshal does. Eg marshal a JAXB what does that really mean :)
>
>
> > Regards,
> >
> > *Raúl Kripalani*
> > Principal Consultant | FuseSource Corp.
> > r...@fusesource.com | fusesource.com <http://www.fusesource.com/>
> > skype: raul.fuse | twitter: @raulvk <http://twitter.com/raulvk>,
> > @fusenews<http://twitter.com/fusenews>
> >
> > <http://twitter.com/fusenews>
> >
> > On 2 May 2012 15:11, Claus Ibsen  wrote:
> >
> >> On Wed, May 2, 2012 at 4:08 PM, Meeraj Kunnumpurath
> >>  wrote:
> >> > Thanks Claus.
> >> >
> >> > So do I defined the custom data format as a Spring bean refer to it
> from
> >> > the unmarshal XML element. Or do I need to use setDataFormatResolver
> on
> >> > CamelContext?
> >> >
> >>
> >> Yes just refer to it's spring bean id name.
> >>
> >> You can even do that directly in the routes
> >>
> >> 
> >>  ..
> >>  
> >>  ...
> >> 
> >>
> >> See chapter 3, section 3.4.6 in the book as it shows how to write
> >> custom data format and with examples in XML DSL as well.
> >>
> >>
> >> > Thanks
> >> > Meeraj
> >> >
> >> > PS: BTW just got the book, it rocks :)
> >> >
> >> > On Wed, May 2, 2012 at 1:44 PM, Claus Ibsen 
> >> wrote:
> >> >
> >> >> On Wed, May 2, 2012 at 12:04 PM, Meeraj Kunnumpurath
> >> >>  wrote:
> >> >> > Hi,
> >> >> >
> >> >> > I have a need to apply custom transformation using a third party
> >> library.
> >> >> > My plan is to write a new data format. However, I am not sure
> whether
> >> it
> >> >> is
> >> >> > the right component for me, as the need is to have one transform
> >> method,
> >> >> > which doesn't fit well with the marshal/unmarshal pair.
> >> >> >
> >> >>
> >> >> A data format dont have to support both. For example tiny markup only
> >> >> support one of them.
> >> >>
> >> >>
> >> >> > A second question I have on this is once I have defined the
> component,
> >> >> how
> >> >> > do I integrate that into the Spring DSL. With a custom data
> format, I
> >> ran
> >> >> > into the following problems ..
> >> >> >
> >> >> > 1. Since the JAXB contex