Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 5.3

...

3) Edit the <servicemix1>/conf/activemq.xml file and configure the ActiveMQ peristence adapter:

Code Block
XML
XML
borderStylesolidXML
  <!-- We use 0.0.0.0 per AMQ-2094 -->
  <amq:transportConnectors>
     <amq:transportConnector uri="tcp://0.0.0.0:61616"/>
  </amq:transportConnectors>

  <amq:persistenceAdapter>
      <amq:amqPersistenceAdapter directory="file:<shared>/data/amq"/>
  </amq:persistenceAdapter>

4) Edit <servicemix2>/conf/activemq.xml and verify the ActiveMQ peristence adapter configuration.

Code Block
XML
XML
borderStylesolidXML
  <amq:transportConnectors>
     <amq:transportConnector uri="tcp://0.0.0.0:61616"/>
  </amq:transportConnectors>

  <amq:persistenceAdapter>
      <amq:amqPersistenceAdapter directory="file:<shared>/data/amq"/>
  </amq:persistenceAdapter>

Info
titlePlease Note
  • Both configurations use the exact same dataDirectory.
  • Both configurations use the exact same transportConnector configuration. There will NOT be a port conflict as the slaves {{TransportConnector}}s will not be activated until a failover event occurs.
  • This example is for a shared filesystem master/slave. For shared JDBC master/slave you would modify the persistence adapter so that both instances point to the same dataSource, for example:
Code Block
XML
XML
borderStylesolidXML
<amq:persistenceAdapter>
      <amq:jdbcPersistenceAdapter dataSource="#oracle-ds" /> 
</amq:persistenceAdapter>

<bean id="oracle-ds" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
 	 <property name="driverClassName" value="oracle.jdbc.driver.OracleDriver" /> 
  <property name="url" value="jdbc:oracle:thin:@192.168.1.4:1521:mydbname" /> 
  <property name="username" value="smix_node1_ha" /> 
  <property name="password" value="smix_node1_ha" /> 
  <property name="poolPreparedStatements" value="true" /> 
</bean>

  • With ServiceMix 4, you will be able to use SERVICEMIX_BASE to specify the <servicemix>/conf directory so two installs will not be necessary.

...

You pay for this flexibility with additional configuration overhead. Specifically you may need to introduce failover URLs into your deployed component configurations.

Example:

Code Block
XML
XML
borderStylesolidXML
failover://(tcp://host_servicemix1:61616,tcp://host_servicemix2:61616)?initialReconnectDelay=100

...

Here's an example of a static discovery configuration:

Code Block
XML
XML
borderStylesolidXML

<!-- We are setting our brokerName to be unique for this container -->
<amq:broker id="broker" brokerName="host1_broker1" depends-on="jmxServer">

   ....

   <networkConnectors>
      <networkConnector name="host1_to_host2" uri="static://(tcp://host2:61616)"/>

      <!-- Here's what it would like for a three container network -->
      <!-- (Note its not necessary to list our own hostname in the uri list) -->
      <!-- networkConnector name="host1_to_host2_host3" uri="static://(tcp://host2:61616,tcp://host3:61616)"/ -->

   </networkConnectors>

</amq:broker>

Info
titleCluster Configuration Conventions
  • Don't use static and multicast at the same time. If you enable static {{networkConnector}}s then disable multicast and vice versa.
  • When using a network of containers in <servicemix>/activemq.xml ensure that the brokerName attribute is unique for each node in the cluster. This is to ensure that the instances in the network can uniquely identify each other.
  • Ensure the jbi container name configured in <servicemix>/servicemix.xml is unique to the cluster.
  • If you are also using a HA configuration then the brokerName attribute should be the same for both the master and the slave.
  • When configuring a network of containers you need to to ensure that you have a unique persistent stores for each ACTIVE instance. If you are using a JDBC datasource, this means a separate database for each ACTIVE instance.
Code Block
XML
XML
borderStylesolidXML
<property name="url" value="jdbc:mysql://localhost/broker_activemq_host1?relaxAutoCommit=true"/>
  • It is possible to setup a network of containers on the same host. You will need to change the JMS ports and transportConnector ports to avoid port conflicts.

Edit the <servicemix>/conf/servicemix.properties, changing the rmi.port and activemq.port as appropriate.

Code Block
borderStylesolid
rmi.port                   = 1098
rmi.host                   = localhost
jmx.url                    = service:jmx:rmi:///jndi/rmi://${rmi.host}:${rmi.port}/jmxrmi

activemq.port              = 61616
activemq.host              = localhost
activemq.url               = tcp://${activemq.host}:${activemq.port}

...

Here's an example of a multicast discovery configuration:

Code Block
XML
XML
borderStylesolidXML
<networkConnectors>
  <!-- by default just auto discover the other brokers -->
  <networkConnector name="default-nc" uri="multicast://default"/>
</networkConnectors>

...