Buscar este blog

lunes, 10 de abril de 2017

ActiveMQ - SQL Server - JDBC Master-Slave

These are the basic instructions to configure a Shared JDBC Persistence Adapter with SQL Server. The objective is to prepare a master/slave configuration with two or more Brokers.

Tested with ActiveMQ 5.14.4.

Add the following dependencies to ACTIVEMQ_HOME/lib/extra in all brokers:
  • Apache commons dbcp2
  • Apache commons pool 2
  • sqljdbc4

Edit the broker config in ACTIVEMQ_HOME/conf/activemq.xml, for all nodes:
<beans ... >

 (...)
  
 <bean id="sqlServerDS" class="org.apache.commons.dbcp2.BasicDataSource" destroy-method="close">
   <property name="driverClassName" value="com.microsoft.sqlserver.jdbc.SQLServerDriver"/>
   <property name="url" value="jdbc:sqlserver://windowsServer-R2:1433;DatabaseName=ActiveMQ"/>
   <property name="username" value="activemq"/>
   <property name="password" value="activemq"/>
   <property name="poolPreparedStatements" value="true"/>
 </bean>
 
 (...)
  
 <broker xmlns="http://activemq.apache.org/schema/core" brokerName="brokerA" dataDirectory="${activemq.data}">  
     (...)
  
     <persistenceAdapter>
        <jdbcPersistenceAdapter dataDirectory="${activemq.base}/data" dataSource="#sqlServerDS" />          
     </persistenceAdapter>
  
     (...)
 </broker>
</beans>

The database should be empty and the first time the first broker starts, all tables will be automatically created (you could get some warnings at this point)


No hay comentarios:

Publicar un comentario