title: Spring integration asynchronous communication synchronous response
body: <p>I currently have an inbound https gateway. In the internal processing of the request from http gateway I  call multiple http web services. Currently as I monitored from a debug point if I am calling 4 web services from a publish-subscribe channel they are executed one after another. Then after 4 of the services are called one by one they are aggregated and a response is returned. The problem here is that there is the potential to be N number of calls, so essentially there could only be 2 http web service calls or there could be even 100. In order to solve this I added a task executor to the publish subsce channel as follows</p>
  
  <pre><code>&lt;int:publish-subscribe-channel id="ta-htl-data-router-channel" apply-sequence="true" task-executor="pool" /&gt;
  
  &lt;task:executor id="pool" pool-size="10"/&gt;
  </code></pre>
  
  <p>Then while the web router channel subscribers are executed synchronously the http inbound gateway stops working properly, that is I get the following error message </p>
  
  <pre><code>Reply message received but the receiving thread has already received a reply
  </code></pre>
  
  <p>And I get a response json string TO DOWNLOAD instead of it being showed in the browser as a respone.</p>
  
  <p>How I can I call multiple external web services asynchronously and send an aggregated response to the http inbound gateway. Therefore while the overall http inbound gateway request to response occurs synchronously the calling of the multiple external web services internally happens asynchronously to reduce the processing time.</p>