1st QUESTION:
I can not understand the difference between enrich() and pollEnrich() . Perhaps the terms Camel are not so great.
I read here: http://camel.apache.org/content-enricher.html
Content Enrichment Using DSL Enrichment
Camel comes with two DSL enriched content flavors
enrich uses Producer to obtain additional data. This is commonly used for Request Reply messaging, for example, to call an external web service. pollEnrich, on the other hand, uses the Consumer Consumer to obtain additional data. It is commonly used to report messaging events, such as reading a file or uploading an FTP file.
I donβt understand what the difference is. They both seem to receive additional data (web service response, FTP file) by consuming it. So why do they say that getting a web service response is done by a "producer"?
2nd QUESTION:
In the book "Camel in Action" p. 72 they say:
Information on the use of enrichment and pollEnrich in the current exchange
Neither enrichment nor pollEnrich can use any information from the current exchange. This means, for example, that you cannot save the file header on the exchange for pollEnrich to use select a specific file. This may change in the future if the Camel team can find a solution.
However, to implement the aggregation strategy, they provide a code example similar to the one below:
public class ExampleAggregationStrategy implements AggregationStrategy { public Exchange aggregate(Exchange original, Exchange resource) { Object originalBody = original.getIn().getBody(); Object resourceResponse = resource.getIn().getBody(); Object mergeResult = ...
In this example, I see that they have access to Exchange original , isn't this the current exchange? If not, then what kind of exchange is an "initial exchange"? And what do they mean by "current exchange"?