java – RabbitMQ com. rabbitmq. client. Alreadyclosedexception: the connection has been closed due to a connection error

I use rabbitmq as a proxy to send requests and responses between my different applications Although I face strange behavior from rabbitmq It gave me this exception after processing 2500 to 3000 records

One more thing, when I tried to run it on the client, there was a 2 second delay between messages. This problem did happen This is the code I'm trying to post

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 for my client 0. Any suggestion will be welcomed

Solution

You can try to use QoS values (although it is not clear from the documentation whether this has an impact on the publisher):

this.channel.basicQos(1);

See: http://www.rabbitmq.com/releases/rabbitmq-java-client/current-javadoc/com/rabbitmq/client/Channel.html#basicQos -int-.

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>