You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by dknig1b <da...@yahoo.com> on 2008/04/04 19:51:17 UTC

queue connecting to wrong broker.

I have a set up where I have 3 servers and 2 brokers:

Server A: running an embedded broker (BrokerA) on localhost:61616
                providing a message Queue called QueueOne

Server B: subscribes to QueueOne on localhost:61616
               has an embedded broker (BrokerB) producing a topic TopicOne
on localhost 61617

Server C: subscribes to topic T1.


As I have things set up, when I start server B, the queue connects to the
broker on Server even though I'm
telling it to connect to localhost:61617.

Without the broker on Server B, the queue subscriber on Server B connects to
the broker on Server A, however the minute I include the broker on Server B,
and restart, the Queue connects to brokerB instead of BrokerA.

I'm confused about where I'm going wrong.  I am embedding activemq 4.1.1
ontop of Tomcat 5.5.9. 
My configurations are listed below:

Server A:  Context.xml setting up JNDI:
          <Resource name="jms/ConnectionFactory" auth="Container"
type="org.apache.activemq.ActiveMQConnectionFactory" description="JMS
Connection Factory" factory="org.apache.activemq.jndi.JNDIReferenceFactory"
brokerURL="vm://localhost" brokerName="ActiveMQBroker"/>

          <Resource name="jms/QueueOne" auth="Container"
type="org.apache.activemq.command.ActiveMQQueue" description="Queue One"
factory="org.apache.activemq.jndi.JNDIReferenceFactory"
physicalName="QueueOne"/>

ServerA activemq.xml:
<beans>
  <bean
class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"/>
  <broker useJmx="false"  xmlns="http://activemq.org/config/1.0"
persistent="false">
    <transportConnectors>
      <transportConnector uri="tcp://localhost:61616"
discoveryUri="multicast://default"/>
    </transportConnectors>
    <networkConnectors>
      <networkConnector uri="multicast://default"/>
    </networkConnectors>
  </broker>
</beans>

Server B: Context.xml to setup JNDI:

<Resource name="jms/QueueConnectionFactory" auth="Container"
type="org.apache.activemq.ActiveMQConnectionFactory" description="JMS
Connection Factory" factory="org.apache.activemq.jndi.JNDIReferenceFactory"
brokerURL="tcp://127.0.0.1:61616" brokerName="ActiveMQBroker"
useEmbeddedBroker="false"/>

<Resource name="jms/messageQueueOne" auth="Container"
type="org.apache.activemq.command.ActiveMQQueue" description="CMC VDS Queue"
factory="org.apache.activemq.jndi.JNDIReferenceFactory"
physicalName="QueueOne"/>

         <Resource name="jms/ConnectionFactory" auth="Container"
type="org.apache.activemq.ActiveMQConnectionFactory" description="JMS
Connection Factory" factory="org.apache.activemq.jndi.JNDIReferenceFactory"
brokerURL="tcp://127.0.0.1:61617" useEmbeddedBroker="true"
brokerName="TopicProviderActiveMQBroker"/>

          <Resource name="jms/FeedNotificationTopic" auth="Container"
type="org.apache.activemq.command.ActiveMQTopic" description="Topic to
notify when a feed successfully executes."
factory="org.apache.activemq.jndi.JNDIReferenceFactory"
physicalName="TopicOne"/>

ServerB: activemq.xml:

<beans>
  <bean
class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"/>
  <broker useJmx="false"  xmlns="http://activemq.org/config/1.0"
persistent="false">
    <transportConnectors>
      <transportConnector uri="tcp://localhost:61617" />
    </transportConnectors>
    <destinations>
      <topic physicalName="TopicOne" />
    </destinations>
  </broker>
</beans>

With this configuration when I start ServerB and tail the activemq logs, I
can see that BrokerB is creating a new destination for QueueOne
DEBUG|2008-04-04 10:20:13,970 ActiveMQ Transport:
tcp:///localhost:41048|org.apache.activemq.broker.region.AbstractRegion|||Adding
destination: queue://QueueOne

which apparently the queue client subscribes to, instead of the queue on
BrokerA.

How can I prevent this?

Thanks.
-- 
View this message in context: http://www.nabble.com/queue-connecting-to-wrong-broker.-tp16494451s2354p16494451.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.


Re: queue connecting to wrong broker.

Posted by Mario Siegenthaler <ms...@inventsoft.ch>.
Your problem might be that the two brokers are in a network of brokers
due to this line
   <networkConnector uri="multicast://default"/>
in the configuration (discovery via multicast).
However your config for broker B shouldn't do multicast discovery, but still..

Else you'll need to use jms/QueueConnectionFactory for all operations
related to Queue one. I'd probably use speaking names for the two
ConnectionFactories in JNDI (like jms/RemoteCF and jms/LocalCF).

Mario

On Fri, Apr 4, 2008 at 7:51 PM, dknig1b <da...@yahoo.com> wrote:
>
>  I have a set up where I have 3 servers and 2 brokers:
>
>  Server A: running an embedded broker (BrokerA) on localhost:61616
>                 providing a message Queue called QueueOne
>
>  Server B: subscribes to QueueOne on localhost:61616
>                has an embedded broker (BrokerB) producing a topic TopicOne
>  on localhost 61617
>
>  Server C: subscribes to topic T1.
>
>
>  As I have things set up, when I start server B, the queue connects to the
>  broker on Server even though I'm
>  telling it to connect to localhost:61617.
>
>  Without the broker on Server B, the queue subscriber on Server B connects to
>  the broker on Server A, however the minute I include the broker on Server B,
>  and restart, the Queue connects to brokerB instead of BrokerA.