1
votes

An example of the integration diagram is as follows

  1. HTTP Inbound gateway along with GET parameters such as for example "dataValue"
  2. Call two seperate http outbound gateways
  3. Process the response of both the outbound gateways
  4. Display the response of the result of both outbound gateways along with the passed GET parameters

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

1

1 Answers

0
votes

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.