1ST QUESTION:
I\'m not able to really understand the difference between enrich()
and pollEnrich()
. Maybe the terms Camel u
Here is the difference:
enrich
assumes you want to use an incoming Exchange as a parameter to an another service request. for example, your incoming Exchange could be a userID, but you really need the entire User object, so you could enrich
it by passing the userID to a REST service that returns the User object which becomes the Exchange, etc.
pollEnrich
assumes the incoming Exchange is a simple trigger that tell a PollingConsumer to look for data and create an Exchange (ignoring the contents of the incoming Exchange). For example, you could have a timer or other business process event that requires picking up a file for processing, etc. that said, the incoming Exchange data is NOT used to dynamically configure the PollingConsumer...only the URI is used for this.
That said, as of Camel 2.12, there is an option to specify an aggregation strategy to combine the incoming/returned Exchanges for both enrich
and pollEnrich
See this unit test for an example of pollEnrich with an aggregation strategy