You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Octavio Kidd <oc...@icloud.com> on 2017/05/05 15:12:56 UTC

Splitter and AggregationStrategies

Hi,

I’m working on a Camel route whose goal is to build an XML string and send it in a request. I get the data in a JSON array (of variable size) that I’m successfully parsing and splitting. Now the splitter is the part that I’m having trouble with, specifically aggregating the data back together. I don’t have control over this particular deployment, so whatever I do, has to be done in Camel’s XML DSL without creating new classes.

Things that I’ve tried:

- I tried appending text to a property created outside the splitter, but it seems that while inside the splitter, properties created outside of it are visible but cannot be modified from within the splitter. (here inside and outside refers to whether something is written inside or outside of the <split> tag).

- I read all the examples on aggregator, but all of them use a <bean> to then have the strategyRef available on the splitter. The thing is, we’re not using Spring on this project, so there isn’t a Spring context up and running as far as I know, nor is there any Spring context configuration. We’re using this method to load routes:
http://camel.apache.org/loading-routes-from-xml-files.html <http://camel.apache.org/loading-routes-from-xml-files.html>

- Just as a proof of concept, I added an aggregation strategy object to the registry directly, and expectedly, I was able to reference it from my route and everything worked as intended. This is however not a feasible solution, since it involves modifying the source code.

So my questions are:

- Is there any way of relaying data from each “path” of the splitter back to the route that called it without relying on an aggregation strategy?

- alternatively, is there any way to add an object to the context’s registry from the XML DSL, without relying on Spring’s <bean> definition?


Thanks in advance,


Octavio Kidd

Re: Splitter and AggregationStrategies

Posted by Claus Ibsen <cl...@gmail.com>.
Hi

Didnt read the entire email but check this EIP, and see the "splitter
only section"
http://camel.apache.org/composed-message-processor.html

this allows you to split using for-join in same "leg" and therefore be
able to return data to client.

On Fri, May 5, 2017 at 11:12 AM, Octavio Kidd <oc...@icloud.com> wrote:
> Hi,
>
> I’m working on a Camel route whose goal is to build an XML string and send it in a request. I get the data in a JSON array (of variable size) that I’m successfully parsing and splitting. Now the splitter is the part that I’m having trouble with, specifically aggregating the data back together. I don’t have control over this particular deployment, so whatever I do, has to be done in Camel’s XML DSL without creating new classes.
>
> Things that I’ve tried:
>
> - I tried appending text to a property created outside the splitter, but it seems that while inside the splitter, properties created outside of it are visible but cannot be modified from within the splitter. (here inside and outside refers to whether something is written inside or outside of the <split> tag).
>
> - I read all the examples on aggregator, but all of them use a <bean> to then have the strategyRef available on the splitter. The thing is, we’re not using Spring on this project, so there isn’t a Spring context up and running as far as I know, nor is there any Spring context configuration. We’re using this method to load routes:
> http://camel.apache.org/loading-routes-from-xml-files.html <http://camel.apache.org/loading-routes-from-xml-files.html>
>
> - Just as a proof of concept, I added an aggregation strategy object to the registry directly, and expectedly, I was able to reference it from my route and everything worked as intended. This is however not a feasible solution, since it involves modifying the source code.
>
> So my questions are:
>
> - Is there any way of relaying data from each “path” of the splitter back to the route that called it without relying on an aggregation strategy?
>
> - alternatively, is there any way to add an object to the context’s registry from the XML DSL, without relying on Spring’s <bean> definition?
>
>
> Thanks in advance,
>
>
> Octavio Kidd



-- 
Claus Ibsen
-----------------
http://davsclaus.com @davsclaus
Camel in Action 2: https://www.manning.com/ibsen2