title: ActiveMQ consume/forward messages from another ActiveMQ instance
body: <p>I have two brokers A and B. If I want to forward message from A to B everything is simple. I just need network connector in A broker configured like this:</p>
  <pre class="lang-xml prettyprint-override"><code>&lt;networkConnectors&gt;
      &lt;networkConnector staticBridge=&quot;true&quot; userName=&quot;user&quot; password=&quot;pass&quot; uri=&quot;static://(tcp://B:61616)&quot;&gt;
          &lt;staticallyIncludedDestinations&gt;
              &lt;queue physicalName=&quot;QUEUE.TO.FORWARD.MESSAGE&quot; /&gt;
          &lt;/staticallyIncludedDestinations&gt;
      &lt;/networkConnector&gt;
  &lt;/networkConnectors&gt;
  </code></pre>
  <p>I tought if I want to consume messageges from broker B from some other queue (let's name it QUEUE.TO.CONSUME) i just need do the same thing but with duplex set to true and just listen on QUEUE.TO.CONSUME on broker A like this:</p>
  <pre class="lang-xml prettyprint-override"><code>&lt;networkConnectors&gt;
      &lt;networkConnector name=&quot;from-B-to-A&quot; staticBridge=&quot;true&quot; duplex=&quot;true&quot; userName=&quot;user&quot; password=&quot;pass&quot; uri=&quot;static://(tcp://B:61616)&quot;&gt;
          &lt;staticallyIncludedDestinations&gt;
              &lt;queue physicalName=&quot;QUEUE.TO.CONSUME&quot; /&gt;
          &lt;/staticallyIncludedDestinations&gt;
      &lt;/networkConnector&gt;
      &lt;networkConnector staticBridge=&quot;true&quot; userName=&quot;user&quot; password=&quot;pass&quot; uri=&quot;static://(tcp://B:61616)&quot;&gt;
          &lt;staticallyIncludedDestinations&gt;
              &lt;queue physicalName=&quot;QUEUE.TO.FORWARD.MESSAGE&quot; /&gt;
          &lt;/staticallyIncludedDestinations&gt;
      &lt;/networkConnector&gt;
  &lt;/networkConnectors&gt;
  </code></pre>
  <p>But it does not work as I expected. It seem that only every second message is forwared and the remaining are just lost. Suprisingly that creates two consumers on broker B QUEUE.TO.CONSUME and I assume that one of them consumes message without forwarding to broker A. How to create bridge on broker A that allows me consume messages from broker B without loosing messages. Creating network connector in broker B is not an option for now.
  I've also tried create inbound queue bridge like this:</p>
  <pre class="lang-xml prettyprint-override"><code>&lt;jmsBridgeConnectors&gt;
      &lt;jmsQueueConnector outboundQueueConnectionFactory=&quot;#remoteBroker&quot; localUsername=&quot;user&quot; localPassword=&quot;password&quot;&gt;
          &lt;inboundQueueBridges&gt;
              &lt;inboundQueueBridge inboundQueueName=&quot;QUEUE.TO.CONSUME&quot; localQueueName=&quot;QUEUE.TO.CONSUME&quot; /&gt;
          &lt;/inboundQueueBridges&gt;
      &lt;/jmsQueueConnector&gt;
  &lt;/jmsBridgeConnectors&gt;
  ...
  &lt;/broker&gt;
  &lt;bean id=&quot;remoteBroker&quot; class=&quot;org.apache.activemq.ActiveMQConnectionFactory&quot;&gt;
          &lt;property name=&quot;brokerURL&quot; value=&quot;failover://(nio:B:61616)&quot; /&gt;
          &lt;property name=&quot;userName&quot; value=&quot;user&quot; /&gt;
          &lt;property name=&quot;password&quot; value=&quot;password&quot; /&gt;
  &lt;/bean&gt;
  </code></pre>
  <p>This configuration creates consumer on remote broker B but it doesn't consume any messages which just hanging as enqueued and nothing happens. Broker A still doesn't receive any messages to its local queue.</p>