[rabbitmq-discuss] Monitoring an AMQP Exchange/Queue in	Java...Problem with passive creation
    Boisson, Franck 
    Franck.Boisson at mlp.com
       
    Thu Sep 17 02:10:06 BST 2009
    
    
  
H,
 
Here is my problem (quickly explained on the rabbitmq IRC channel):
21:48:29 | <Franckyky> Hello guys
21:48:56 | <Franckyky> Do you know how to monitor an exchange or a queue
in order to detect when it goes down ?
21:49:42 | <Franckyky> for the moment, I am doing it every 5 sec: create
a tmp channel, try to declare the queue/exchange with passive=true,
abort the tmp channel
21:50:07 | <Franckyky> This is working for a moment but seems that
sometimes it fail
21:50:26 | <Franckyky> without any reason (when I look on the rabbitmq
server, exchange/queue is still alive)
21:50:29 | <Franckyky> any idea?
 
Hereunder is my isExchangeExists java function as an exemple of what I
am doing:
public boolean isExchangeExists(String exchangeId, String exchangeType)
throws Exception{
    boolean toReturn = true; 
    Channel tmpChannel = null;
    synchronized(this.amqpMainConnection){
      try{
        tmpChannel = this.amqpMainConnection.createChannel();
      }catch(Exception exc){
        throw new Exception ("Unable to create a temporary channel to
check if exchange " + 
                             exchangeId + " exists [" + exc.getMessage()
+ "]");
      }
    }
    try{
      // Try to create the exchange as passive (will raise an exception
if not exists)
      tmpChannel.exchangeDeclare(exchangeId, exchangeType, true, false,
false, null); //exchange, type, passive, durable, autoDelete, arguments
    }catch(Exception exc){
      toReturn = false;
    }finally{
      try{ tmpChannel.abort(); }catch(Exception unmanagedExc){}
      tmpChannel = null;
    }
    return toReturn;    
  }
 
Do you have any idea about what is happening here?
 
Best regards
Franck
 
 
######################################################################
The information contained in this communication is confidential and
may contain information that is privileged or exempt from disclosure
under applicable law. If you are not a named addressee, please notify
the sender immediately and delete this email from your system.
If you have received this communication, and are not a named
recipient, you are hereby notified that any dissemination,
distribution or copying of this communication is strictly prohibited.
######################################################################
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.rabbitmq.com/pipermail/rabbitmq-discuss/attachments/20090917/ad5fb6fb/attachment.htm 
    
    
More information about the rabbitmq-discuss
mailing list