Camel - content enricher: enrich() vs pollEnrich()

前端 未结 1 1588
旧时难觅i
旧时难觅i 2021-01-12 11:14

1ST QUESTION:

I\'m not able to really understand the difference between enrich() and pollEnrich(). Maybe the terms Camel u

相关标签:
1条回答
  • 2021-01-12 12:14

    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

    0 讨论(0)
提交回复
热议问题