Announcement Announcement Module
No announcement yet.
Making Async calls to HTTP Outbound Gateway. Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Making Async calls to HTTP Outbound Gateway.

    I have a system that I am looking at retrofitting a backend with spring integration.

    A few of the patterns in this system, look at hitting the same web service and/or HTTP server (I have both) with multiple requests and slightly different parameters. The results are then aggregated together and presented to the user

    I have it working successfully in a synchronous mode, where the request comes in thru a Gateway, is "split" into messages that contain the key value for each call (call with A, call with B, call with XYZ). Each message then goes to an HTTP Outbound Gateway, the call is made, and is returned. The results are then aggregated together and shipped back through the Gateway.

    What I'm struggling with is making these HTTP calls asynchronously. The current system uses Futures to make each call in a separate thread. I would like a similar pattern.

    What I think I need to do is to create a second Gateway, which wraps the HTTP outbound gateway, and use the <Future> return value to create an async call. However, I'm not sure how this would work with the aggregation, and something about it feels like there should be a cleaner way. I haven't had the opportunity to use Spring Integration in 3 years, so I'm trying to relearn all the things.

    Am I missing something, or is this how you need to do it?

  • #2
    You can simply make the channels (to which the outbound-gateways are subscribed) ExecutorChannels ( and

    That way, each request will run on a separate thread - the aggregation release will occur on the thread that receives the final response. Your original thread will wait in the gateway for the response (or you can use an async gateway and wait on a Future.


    • #3
      Thank you. I knew it was something "obvious" that I missed. I just need to understand how failover will work now.