activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From manishbel <>
Subject Need help with Failover in Master Slave scenario
Date Fri, 03 Aug 2007 23:03:53 GMT

I have:
- Jdbc Master Slave brokers setup in a weblogic cluster.

- Each instance has set of receivers/consumer consuming message from queues
with exclusive consumer 
   behavior  so at a time any one of the cluster instance will be receiving
and processing all the messages.
- the receivers use connection factory with Failover transport.

What i want is 
- When one of the cluster instances go down. the receivers in the other
cluster instance should switch to the broker that has become master because
of the original master's failure. I tested it out but it doesnt work for me.

Here is the receiver code

   protected void performRunInternal() throws Exception {
      Message message = consumer.receive(getWakeupInterval());
      if (message != null && message instanceof TextMessage) {
         long count = 0;
         debug("Received Message :" + count);
         TextMessage textMessage = (TextMessage) message;
         SomeClass incomingMessage =
messageFactory.createMessage(messageIndexSequence.getNext(), textMessage);
         messageHandler.handleMessage(incomingMessage, message);
         if (incomingMessage.getException() != null) {
            debug("Message number " + count + " errored out " +
         if (count % 1000 == 0) {
            getLogger().info(count + " messages received");

The question is whether the consume.receive is going to take care of
failover? for that reason i registered my receiver as a Transport Listener
but for some reason the transport listener methods are not being called when
i killed one of the cluster instances where the Master Broker was running.

Here is the initialization code.

   protected void performInitializeInternal() throws Exception {
      getLogger().info("Starting receiver");
      connection = factory.createConnection(); -- > This is the failover
connection factory.

      if (connection instanceof ActiveMQConnection) {
         getLogger().info(getId() + " is becoming the transport listener");
         ((ActiveMQConnection) connection).addTransportListener(this);
      Session session = connection.createSession(false,
      consumer = session.createConsumer(pubTopic);


Any suggestions would be greatly appreciated.


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

View raw message