I am trying to implement below flow in Spring Integration. Below is my requirement.
- Asynchronous Gateway, starting point, receives request for search and returns Future back
- Gateway sends request to multiple channel to perform search
- Each channel contacts HTTP based websites with search string
- Aggregator receives results from all channel of step 3 output to outputchannel
I am not sure how to achieve step 3 and step 4 or is there a better way of doing this in spring integration. Basically I have to contact multiple sites with search string and produce aggregated results.
If you want the http calls to run concurrently, add a task-executor to the publish-subscribe-channel; that way each http call will run on a separate thread (as long as the task executor is configured with sufficient threads.
If you want the calls to occur serially, leave the task executor off.
Unless you want to do something with the aggregated result before returning it, just leave off the output-channel on the aggregator and the framework will send the aggregated response to the gateway (Future). You don’t need a default-reply-channel on the gateway.