[
https://issues.apache.org/jira/browse/CAMEL-6791?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13790186#comment-13790186
]
Sergey Zolotaryov commented on CAMEL-6791:
------------------------------------------
Ok. I figured out how to fix the code. Camel example on splitter helped a lot :)
Here is what has to be used in order for the aggregation work: 1) specify the
aggregation strategy in split definition, not after it, otherwise it does not
work; 2) after the processor that handles split sub-exchanges you must say
end() so that sub-exchanges don't get returned by jetty.
Here is how the changed code looks like:
{code}
route = route.split(splitExchangeIntoOneExchangePerFile(), new
GroupedExchangeAggregationStrategy());
// now move/copy(?) the files to final destination
route = route.to("file://output?fileName=${header." + BATCH_FILE_INDEX +
"}.txt").end();
// no explicit aggregation afterwards
{code}
> Aggregation result is lost when used with Jetty http endpoint
> -------------------------------------------------------------
>
> Key: CAMEL-6791
> URL: https://issues.apache.org/jira/browse/CAMEL-6791
> Project: Camel
> Issue Type: Bug
> Components: camel-http
> Affects Versions: 2.9.0, 2.12.1
> Environment: windows 7
> Reporter: Sergey Zolotaryov
> Priority: Minor
> Attachments: test.zip
>
>
> We have a requirement to return the result of some processing in an HTTP
> response. Here's how this looks:
> Jetty http endpoint triggers processing ->
> data is retrieved into an iterator ->
> multiple renderers process the model objects and write output to temporary
> files ->
> a file endpoint copies files to final destination ->
> an aggregator puts generated file names into exchange body as a list ->
> the camel servlet renders the exchange body
> Everything goes well until the final step, where we can only see the
> filenames of temporary files, but not the final ones. Looks like the
> aggregation result is just ignored. I am attaching an eclipse project where
> you can just see how it happens.
--
This message was sent by Atlassian JIRA
(v6.1#6144)