You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by Vijay <vi...@gmail.com> on 2011/06/24 08:07:23 UTC
Master/slave configuration
server1
--------
Master
JMS client 1 connects to Master
Server2
--------
Slave
JMS client 2 connects to slave
I need clarification on following scenarios.
1.If master dies, slave is still keeping JMS client 1 connections. Is
there a way to delete these connections once the master dies ?
2. If master dies what is the best way to detect the same on JMS client?
--
View this message in context: http://activemq.2283324.n4.nabble.com/Master-slave-configuration-tp3621735p3621735.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.
Re: Master/slave configuration
Posted by Eivind Sivertsen <ei...@gmail.com>.
When you create a connection using the ActiveMQConnectionFactory, cast
it to an ActiveMQConnection:
ActiveMQConnectionFactory factory = new
ActiveMQConnectionFactory(brokerUrl);
ActiveMQConnection conn = (ActiveMQConnection) factory.createConnection();
And let your TransportListener implementation have a reference to conn.
In your TransportListener implementation, on transportResumed(), use
conn.getBrokerName()
conn.getBrokerInfo().getBrokerURL()
conn.getBrokerInfo().isSlaveBroker()
(haven't tried this myself, but it hopefylly works)
Re: Master/slave configuration
Posted by Vijay <vi...@gmail.com>.
Thanks for the replies.
The reason we have redundant clients is to survive hardware crash as both
broker and client reside on the same machine.
We keep the Client 2 live to just keep trying for connection to slave until
master goes down. Once slave becomes master, it gets connection and starts
processing.
coming to original Question.
Server1
--------
Master -
standalone JMS Client 1
I want to handle a rare scenrio.
Obvisouly Master broker, client run in two diffrent OS processes. If Master
process dies for some X reason, I want to shutdown the client as well.
Probably will give out a try with Transport listener.
Before killing the standalone JMS client 1 programmaticlly, I would also
like to check if the slave Broker actually became Master (just as a double
check) in addition to Transport listener way. How can I verify this
programatically given that I have just broker url for slave..
--
View this message in context: http://activemq.2283324.n4.nabble.com/Master-slave-configuration-tp3621735p3621817.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.
Re: Master/slave configuration
Posted by eivindsi <ei...@gmail.com>.
Instead of having a client "connected" to the slave (the slave will not
accept connections until the master dies, if I remember correctly), you
should use only one client (JMS client 1) and use the failover transport.
The client will then automatically start using the slave when the master
dies.
http://activemq.apache.org/failover-transport-reference.html
http://activemq.apache.org/failover-transport-reference.html
To detect connection failure you can use
ActiveMQConnectionFactory.setTransportListener(..), and implement the
transportInterupted() and transportResumed() methods.
--
View this message in context: http://activemq.2283324.n4.nabble.com/Master-slave-configuration-tp3621735p3621790.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.
Re: Master/slave configuration
Posted by Johan Edstrom <se...@gmail.com>.
failover.
Dead is dead.
On Jun 24, 2011, at 12:07 AM, Vijay wrote:
> server1
> --------
> Master
> JMS client 1 connects to Master
>
> Server2
> --------
> Slave
> JMS client 2 connects to slave
>
>
> I need clarification on following scenarios.
>
> 1.If master dies, slave is still keeping JMS client 1 connections. Is
> there a way to delete these connections once the master dies ?
> 2. If master dies what is the best way to detect the same on JMS client?
>
>
>
> --
> View this message in context: http://activemq.2283324.n4.nabble.com/Master-slave-configuration-tp3621735p3621735.html
> Sent from the ActiveMQ - User mailing list archive at Nabble.com.