activemq-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From io42 <>
Subject Shared DB Master/Slave configuration/implementation questions
Date Mon, 12 Mar 2012 20:19:29 GMT
I'm trying configure a JDBC-master-slave setup using a PostgreSQL DB and the
xbean URI scheme, but it is unclear to me how I ought to proceed.  Starting
a single broker is straightforward.  In my Java code I am starting the
broker via the following:

     URI brokerURI = new
     BrokerService broker = BrokerFactory.createBroker(brokerURI);

Where my broker is configured in the activemq.xml file:
 <broker xmlns="" useJmx="true"
brokerName="localhost" dataDirectory="${activemq.base}/data">
                <policyEntry topic=">" producerFlowControl="true"
                    <vmCursor />
                <policyEntry queue=">" producerFlowControl="true"
memoryLimit="1mb" prioritizedMessages="true">
			<jdbcPersistenceAdapter  dataDirectory="${activemq.base}/data" 
dataSource="#postgres-ds" createTablesOnStartup="false" />
            <transportConnector name="openwire" uri="tcp://"/>

If I want to use the above as my master broker, how do I configure a slave
broker to point to the same DB?  Must I use a separate XML file for each
broker?  If so, how do I use a failover URL to combine the separate xbean
URIs to both of the XML files? This page  explains that I
should use the failover transport to connect the available brokers [i.e. use
failover:(tcp://broker1:61616,tcp://broker2:61616], but how do I do that
from my java code? 

Thanks in advance for any input you may have.  My apologies if this has
already been addressed before, but I haven't to been able to find anything
through my search.

Additional bonus questions:  When the master broker has a DB lock, is this a
read lock as well as a write lock?  Does it make any sense for a Slave
broker to be doing anything other than waiting on the master to fail (e.g.
could the slave broker of one DB conceivably be the master of another)?

View this message in context:
Sent from the ActiveMQ - Dev mailing list archive at

View raw message