I use rabbitmq as a broker to send a request and response between my various applications. For now, I come across strange behavior with a rabbit. This gives me this exception after processing from 2500 to 3000 records.
com.rabbitmq.client.AlreadyClosedException: the connection is already closed due to a connection error; Reason: java.net.SocketException: Connection reset when com.rabbitmq.client.impl.AMQChannel.ensureIsOpen (AMQChannel.java:195) ~ [amqp-client-3.5.6.jar: na] in com.rabbitmq.client. impl.AMQChannel.transmit (AMQChannel.java:309) ~ [AMQP client-3.5.6.jar: on]
Another thing, when I tried to start it with a client with a 2 second delay between messages, this problem arose. This is the code I'm trying to publish.
try {
byte[] e = jsonMessage.getBytes(RabbitConf.COMMUNICATION_ENCODING);
this.channel.basicPublish(exchangeType.name(), rountingKey.name(), (BasicProperties)null, e);
} catch (IOException var6) {
this.LOG.error("IOException when sending data to rabbit:", var6);
}
I am using amqp-client 3.6.0 for my client. Any suggestion would be welcome.
source
share