1

I have a RabbitMQ client in Java listening to incoming notification messages to process them (RabbitMQ Java client version 5.5.1). After months of running smoothly, suddenly yesterday I saw this error showing up, after which no message was received:

[AMQP Connection 10.233.44.138:5672] WARN com.rabbitmq.client.impl.ForgivingExceptionHandler - An unexpected connection driver error occured (Exception message: Connection reset)

What is the cause of this error? How to resolve it from occuring again?

ConnectionFactory factory = new ConnectionFactory();
factory.setHost(rabbitMqHost);
factory.setUsername(rabbitMqUser);
factory.setPassword(rabbitMqPass);
factory.setPort(rabbitMqPort);
factory.setVirtualHost("/");

Connection connection = factory.newConnection();
final Channel channel = connection.createChannel();
channel.exchangeDeclare(EXCHANGE_NAME, "fanout");
String queueName = channel.queueDeclare().getQueue();
channel.queueBind(queueName, EXCHANGE_NAME, "");
logger.info("t3- Listening to RabbitMQ notifications...");

channel.basicConsume(queueName, false, new DefaultConsumer(channel) {
    @Override
    public void handleDelivery(String consumerTag, Envelope envelope, AMQP.BasicProperties properties,
            byte[] body) throws IOException {
        // (process the message components here ...)
        final String message = new String(body, "UTF-8");


        try {
            Thread.sleep(500);
        } catch (InterruptedException e) {
        }
                ParseStatusMessage(message);
    }
});

}

Tina J
  • 4,983
  • 13
  • 59
  • 125

0 Answers0