title: Implement a consumer and producer system using Spring integration
body: <p>I want to implement single producer ..multiple consumer problem using Spring <code>SubscribableChannel</code> . I am not able to solve this problem.</p>
  
  <p>For example i have a user as a producer and his friends as consumers. So when the producer user does something it must be published to his friends. </p>
  
  <p>The real problem is the the producer and consumer relationships is dynamic because at any time i can unfriend a user that means it should not any more listen to my activities. So i want some kind of java config where i can subscribe and unsubscribe consumers from producers also there must be something which can detach consumers from producers in case the producers don't exist anymore...</p>
  
  <p>I am having difficulty in designing the channel because there will be <code>number of channel equal to number of users.</code> Also I am not sure how to design the MessageHandler which comes with Spring Integration. </p>
  
  <p>Are there some examples which points in this direction.</p>
  
  <p>What i did so far is now is I have a config bean </p>
  
  <pre><code>@Configuration
  public class ChannelConfig {
  
      @Bean
      public SubscribableChannel subscribeChannel() {
          PublishSubscribeChannel channel = new PublishSubscribeChannel(getAsyncExecutor());
          return channel;
      }
  
      public Executor getAsyncExecutor() {
          ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
          executor.setCorePoolSize(2);
          executor.setMaxPoolSize(50);
          executor.setQueueCapacity(10000);
          executor.setThreadNamePrefix("ChannelExecutor-");
          executor.initialize();
          return executor;
      }
  }
  </code></pre>
  
  <p>which i will inject but than this will be the only sole channel. i want a channel for every user.</p>