title: Spring-integration JMS publish subscribe in both inbound and outbound
body: <p>I am trying to use the example project of Spring-Integration JMS for JMS integration, Which I have done succesfully. How ever I have a slightly different set of requirement. Where I need to listen from 1 JMS Broker using Publish Subscribe pattern and, I need to send the same listened JMS message to another Kafak Queue/or nay other queue. I am struggling with the configuration,  as of now I have configured only for request and response queue. Here are the configuration. Please  help.</p>
  
  <p><strong>Common.xml</strong></p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;beans xmlns="http://www.springframework.org/schema/beans"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xmlns:integration="http://www.springframework.org/schema/integration"
      xsi:schemaLocation="http://www.springframework.org/schema/beans
              http://www.springframework.org/schema/beans/spring-beans.xsd
              http://www.springframework.org/schema/integration
              http://www.springframework.org/schema/integration/spring-integration.xsd"&gt;
  
      &lt;bean id="connectionFactory" class="org.springframework.jms.connection.CachingConnectionFactory"&gt;
          &lt;property name="targetConnectionFactory"&gt;
              &lt;bean class="org.apache.activemq.ActiveMQConnectionFactory"&gt;
                  &lt;property name="brokerURL" value="vm://localhost"/&gt;
              &lt;/bean&gt;
          &lt;/property&gt;
          &lt;property name="sessionCacheSize" value="10"/&gt;
          &lt;property name="cacheProducers" value="false"/&gt;
      &lt;/bean&gt;
  
       &lt;!-- &lt;bean id="requestQueue" class="org.apache.activemq.command.ActiveMQQueue"&gt;
          &lt;constructor-arg value="queue.demo"/&gt;
      &lt;/bean&gt; --&gt;
  
      &lt;bean id="replyQueue" class="org.apache.activemq.command.ActiveMQQueue"&gt;
          &lt;constructor-arg value="queue.reply"/&gt;
      &lt;/bean&gt;
   &lt;bean id="requestQueue" class="org.apache.activemq.command.ActiveMQQueue"&gt;
          &lt;constructor-arg value="queue.request"/&gt;
      &lt;/bean&gt;
  
      &lt;integration:poller id="poller" default="true" fixed-delay="100"/&gt;
  
  &lt;/beans&gt;
  </code></pre>
  
  <p><strong>InboudChanelAdapter</strong></p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;beans:beans xmlns="http://www.springframework.org/schema/integration"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xmlns:beans="http://www.springframework.org/schema/beans"
      xmlns:jms="http://www.springframework.org/schema/integration/jms"
      xmlns:stream="http://www.springframework.org/schema/integration/stream"
      xsi:schemaLocation="http://www.springframework.org/schema/beans
              http://www.springframework.org/schema/beans/spring-beans.xsd
              http://www.springframework.org/schema/integration
              http://www.springframework.org/schema/integration/spring-integration.xsd
              http://www.springframework.org/schema/integration/jms
              http://www.springframework.org/schema/integration/jms/spring-integration-jms.xsd
              http://www.springframework.org/schema/integration/stream
              http://www.springframework.org/schema/integration/stream/spring-integration-stream.xsd"&gt;
  
      &lt;jms:message-driven-channel-adapter id="jmsIn"
              destination="requestQueue"
              channel="jmsInChannel" /&gt;
  
      &lt;channel id="jmsInChannel" /&gt;
  
  
  
      &lt;beans:beans profile="testCase"&gt;
  
          &lt;bridge input-channel="jmsInChannel" output-channel="queueChannel"/&gt;
  
          &lt;channel id="queueChannel"&gt;
              &lt;queue /&gt;
          &lt;/channel&gt;
  
       &lt;/beans:beans&gt; 
  
  &lt;/beans:beans&gt;
  </code></pre>
  
  <p><strong>OutboundChannelAdapter.xml</strong></p>
  
  <pre><code>    &lt;?xml version="1.0" encoding="UTF-8"?&gt;
      &lt;beans:beans xmlns="http://www.springframework.org/schema/integration"
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xmlns:beans="http://www.springframework.org/schema/beans"
          xmlns:jms="http://www.springframework.org/schema/integration/jms"
          xmlns:stream="http://www.springframework.org/schema/integration/stream"
          xsi:schemaLocation="http://www.springframework.org/schema/beans
                  http://www.springframework.org/schema/beans/spring-beans.xsd
                  http://www.springframework.org/schema/integration
                  http://www.springframework.org/schema/integration/spring-integration.xsd
                  http://www.springframework.org/schema/integration/jms
                  http://www.springframework.org/schema/integration/jms/spring-integration-jms.xsd
                  http://www.springframework.org/schema/integration/stream
                  http://www.springframework.org/schema/integration/stream/spring-integration-stream.xsd"&gt;
  
          &lt;stream:stdin-channel-adapter id="stdin" channel="stdinToJmsoutChannel"/&gt;
  
          &lt;channel id="stdinToJmsoutChannel"/&gt;
          &lt;channel id="jmsInChannel" /&gt;
  
          &lt;jms:outbound-channel-adapter id="jmsout" channel="jmsInChannel" destination="requestQueue"/&gt;
  
      &lt;/beans:beans&gt;
   **DemoConfig.xml**
  
      &lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;beans xmlns="http://www.springframework.org/schema/beans"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xmlns:integration="http://www.springframework.org/schema/integration"
      xmlns:jms="http://www.springframework.org/schema/integration/jms"
      xmlns:beans="http://www.springframework.org/schema/beans"
      xsi:schemaLocation="http://www.springframework.org/schema/beans
              http://www.springframework.org/schema/beans/spring-beans.xsd
              http://www.springframework.org/schema/integration
              http://www.springframework.org/schema/integration/spring-integration.xsd
              http://www.springframework.org/schema/integration/jms
              http://www.springframework.org/schema/integration/jms/spring-integration-jms.xsd"&gt;
  
      &lt;bean id="connectionFactory" class="org.springframework.jms.connection.CachingConnectionFactory"&gt;
          &lt;property name="targetConnectionFactory"&gt;
              &lt;bean class="org.apache.activemq.ActiveMQConnectionFactory"&gt;
                  &lt;property name="brokerURL" value="vm://localhost"/&gt;
              &lt;/bean&gt;
          &lt;/property&gt;
          &lt;property name="sessionCacheSize" value="10"/&gt;
          &lt;property name="cacheProducers" value="false"/&gt;
      &lt;/bean&gt;
  
  
       &lt;bean id="connectionFactory2nd" class="org.springframework.jms.connection.CachingConnectionFactory"&gt;
          &lt;property name="targetConnectionFactory"&gt;
              &lt;bean class="org.apache.activemq.ActiveMQConnectionFactory"&gt;
                  &lt;property name="brokerURL" value="vm://localhost"/&gt;
              &lt;/bean&gt;
          &lt;/property&gt;
          &lt;property name="sessionCacheSize" value="10"/&gt;
          &lt;property name="cacheProducers" value="false"/&gt;
      &lt;/bean&gt;
  
  
  
      &lt;bean id="replyQueue" class="org.apache.activemq.command.ActiveMQQueue" &gt;
          &lt;constructor-arg value="queue.reply"/&gt;
      &lt;/bean&gt;
   &lt;bean id="requestQueue" class="org.apache.activemq.command.ActiveMQQueue"&gt;
          &lt;constructor-arg value="queue.request"/&gt;
      &lt;/bean&gt;
  
    &lt;jms:message-driven-channel-adapter id="jmsIn"
          destination="requestQueue"
          channel="jmsInChannel" 
         connection-factory="connectionFactory"/&gt;
  
     &lt;jms:publish-subscribe-channel id= "jmsInChannel"/&gt;
     &lt;jms:topic id="Topic"&gt;&lt;/jms:topic&gt;
     &lt;/&lt;jms:channel&gt;     
  
     &lt;jms:outbound-channel-adapter id="jmsout" channel="jmsInChannel" destination="replyQueue" connection-factory="connectionFactory2nd"/&gt;
  
      &lt;integration:poller id="poller" default="true" fixed-delay="100"/&gt;
  
  &lt;/beans&gt;
  </code></pre>