2

I am trying to create an ActiveMQ Network which will be consisted of 2 Brokers. I have done then configuration as described in the related guide (http://activemq.apache.org/networks-of-brokers.html)

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://activemq.org/config/1.0">

  <broker brokerName="receiver" persistent="false" useJmx="false">  
    <networkConnectors>
      <networkConnector uri="static:(tcp://host2:61616)"/>
    </networkConnectors>

    <persistenceAdapter>
      <memoryPersistenceAdapter/>
    </persistenceAdapter>

   <transportConnectors>
      <transportConnector uri="tcp://host1:61616"/>
    </transportConnectors>
  </broker>
</beans>

In the XML configuration above I am assuming that one of the network brokers is running in host1 and the other in host2. The broker running at host2 will have the opposite values. The JMS fails to start and it does not produce any exceptions in the log files, the only message that appears is

INFO  | Refreshing org.apache.activemq.xbean.XBeanBrokerFactory$1@3df78040: startup date [Tue Nov 22 20:54:53 CET 2011]; root of context hierarchy | org.apache.activemq.xbean.XBeanBrokerFactory$1 | main

Did anyone ever managed to setup a network of two or more ActiveMQ brokers?

Sathyajith Bhat
  • 21,321
  • 22
  • 95
  • 134
user944643
  • 83
  • 2
  • 6

2 Answers2

1

If you are using a static network of brokers, you need to specify all the ips of the brokers forming the network of brokers.

 <networkConnector name="HA Queue" uri="static:(tcp://host1:61616,tcp://host2:61616)"/>

also, try specifying the transport connector in this manner:

    <transportConnectors>
       <transportConnector name="openwire" uri="tcp://0.0.0.0:61616" />
    </transportConnectors>
srodriguez
  • 1,937
  • 2
  • 24
  • 42
  • 1
    Thanks for the reply, as it turns out there was an error on the xml tags, strange though under linux i didn't got any error messages. When i've runned it under windows i got the error on the xml tags. I didn't specified all the ips in the static declaration and so far as i can see the network is formed propertly. – user944643 Dec 02 '11 at 07:33
1

This is a very common thing to do with ActiveMQ. You can get a sample configuration to base your network of brokers on in the ${ACTIVEMQ_HOME}/conf directory (activemq-static-network-broker1.xml and activemq-static-network-broker2.xml).

From what I can see the namespaces of your configuration are wrong. It should read:

<beans
  xmlns="http://www.springframework.org/schema/beans"
  xmlns:amq="http://activemq.apache.org/schema/core"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
    http://activemq.apache.org/schema/core http://activemq.apache.org/schema/core/activemq-core.xsd">

  <broker xmlns="http://activemq.apache.org/schema/core" brokerName="static-broker1">
    <!-- other stuff goes here -->
  </broker>

</beans>

The key thing to be aware of is that this is a Spring configuration (http://www.springframework.org/schema/beans) that has an XBean config that defines the AMQ broker (http://activemq.apache.org/schema/core).

I'd also echo what srodriguez said, use 0.0.0.0 as the host name of your transportConnector.

Jakub Korab
  • 4,974
  • 2
  • 24
  • 34