[rabbitmq-discuss] Question about java client

lariverosc lariverosc at gmail.com
Tue May 7 02:09:37 BST 2013

I have a question related with a particular use case, that I need to
implement using the java client and the cloudamqp service, the scenario is
the following:

I want to send some messages to a queue, in the case of a connection
failure, I need to be notified immediately, in order to manage and recover
from the fault.

My client code looks like this:

        ConnectionFactory connectionFactory = new ConnectionFactory();
        connection = connectionFactory.newConnection();
        channel = connection.createChannel();
        channel.exchangeDeclare("messagesExchange", "direct", true);
        channel.queueDeclare("messagesQueue", true, false, false, null);
        channel.queueBind("messagesQueue", "messagesExchange",
        for (int i = 0;i<10000;i++){ 
          try {
"messagesRK",MessageProperties.PERSISTENT_TEXT_PLAIN, "My
           } catch (IOException ioe) {
             //I would expect that this exception will throw on network
failure but nothing happens 
            System.out.println("Error enqueueing message " + ioe);

And currently I can view how the messages are received, however, when I
abruptly disconnect from the network nothing happens in the first two
minutes (Maybe a timeout setting?), and the sending process continues
without show any error.

My question is ¿How I can get immediate feedback of the connection failure?

View this message in context: http://rabbitmq.1065348.n5.nabble.com/Question-about-java-client-tp26464.html
Sent from the RabbitMQ mailing list archive at Nabble.com.

More information about the rabbitmq-discuss mailing list