ERROR (ForgivingExceptionHandler.java:119) - Consumer com.whgtxx.exam.portal.listener.ScoreMarkerListener$1@125c29d8 (amq.ctag-PGSfYADMSk5inqPjY8sI_g) method handleDelivery for channel AMQChannel(amqp://whgexam@192.168.1.107:5672/,1) threw an exception for channel AMQChannel(amqp://whgexam@192.168.1.107:5672/,1)
com.rabbitmq.client.AlreadyClosedException: channel is already closed due to clean channel shutdown; protocol method: #method<channel.close>(reply-code=200, reply-text=Closed due to exception from Consumer (amq.ctag-PGSfYADMSk5inqPjY8sI_g) method handleDelivery for channel AMQChannel(amqp://whgexam@192.168.1.107:5672/,1), class-id=0, method-id=0)
在调试rabbitmq时出现如上错误,经查是
DefaultConsumer consumer=new DefaultConsumer(channel) {
@Override
public void handleDelivery(String consumerTag,
Envelope envelope,
AMQP.BasicProperties properties,
byte[] body)
throws IOException
{
// 业务处理逻辑
。。。。。
channel.basicAck(deliveryTag, false);
}
};
consumer的handle中的业务处理逻辑代码中存在异常抛出,导致channel.basicAck不能执行,而引发后续处理中的这个报错