Reputation: 7653
An example of the integration diagram is as follows
We have two requirements, one where we need to send two separate requests to two http outbound gateways that provide two different type of responses (one with base data and one with prices data). How can we aggregate these two results for processing. Is there a special type of aggregator, pattern etc that needs to be used
The other requirement being, as we have an a http-inbound gateway which calls the above mentioned two http gateways, processes both requests and produces a json output. In the request to the http-inbound gateway there might be a GET parameter passed called "dataValue" which contains the value "17". When the request is complete after the two http outbound gateway response is processed the "dataValue" parameter and value that was passed as a GET parameter must be attached to the response. What is the best way to store and retieve the "dataValue" parameter of each specific request and attach it to the response. Can we pass this through another channel to an aggregator of the final response or is there a way to store it in a session store for each request and such techniques.
Regards, Milinda
Upvotes: 1
Views: 490
Reputation: 121550
Sorry for the late reply (not sure how have I missed your questio), anyway I hope the answer will be helpful.
Regarding dataValue
GET request param:
You can populate it to the message headers:
<int-http:inbound-gateway path="/myPath?dataValue={dataValue}"
request-channel="processChannel">
<int-http:header name="dataValue" expression="#requestParams.dataValue"/>
</int-http:inbound-gateway>
Re. several <int-http:outbound-gateway>
:
you can use <publish-subscribe-channel>
with apply-sequence="true"
- and the <aggregator>
in the end will group
responses to the single reply
properly.
For better performance you can add executor
to that <publish-subscribe-channel>
, and your <int-http:outbound-gateway>
's will be invoked in parallel.
Upvotes: 0