title: How to wait for completion of multi-threaded publish-subscribe-channel
body: <p>I have a Spring Integration project where I want to process a message concurrently through multiple actions. So I have set up a <code>publish-subscribe-channel</code> with a <code>task-executor</code>. However I want to wait for all processing to complete before moving on. How would I do this?</p>
  
  <pre><code>&lt;publish-subscribe-channel id="myPubSub" task-executor="my10ThreadPool"/&gt;
  
  &lt;channel id="myOutputChannel"/&gt;
  
  &lt;service-activator input-channel="myPubSub" output-channel="myOutputChannel"
           ref="beanA" method="blah"/&gt;
  &lt;service-activator input-channel="myPubSub" output-channel="myOutputChannel"
           ref="beanB" method="blah"/&gt;
  
  &lt;service-activator id="afterThreadingProcessor" input-channel="myOutputChannel" .../&gt;
  </code></pre>
  
  <p>So in the above case, I want my <code>afterThreadingProcessor</code> to be invoked only once after both <code>beanA</code> and <code>beanB</code> have completed their work. However, in the above <code>afterThreadingProcessor</code> will be invoked twice.</p>