-
Notifications
You must be signed in to change notification settings - Fork 626
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Producer appeared Channel shutdown: clean channel shutdown; protocol method: #method<channel.close>(reply-code=200, reply-text=Closed due to exception from ConfirmListener.handle{N,A}ck, class-id=0, method-id=0) #849
Comments
It means we had some problem processing the acknowledgment; you should see the root cause elsewhere in the log; I just ran a test...
|
Only this log is output, there is no stack information, and normal business is not affected, only the error log is output. |
It's truncated; can you add the rest? (before and after). |
This exception is a failure to close the channel after the fact. Please post the whole log (or at least from before the problem to after the last log), so I can get the full picture? |
AfterThrowingLogTemplate
|
That is after the fact - it's a failure to close the channel after the ack was failed to be processed. Again; please provide more of the log; I can't help when you only provide snippets. |
@Override
public void onMessage(Message message, Channel channel) {
MessageProperties messageProperties = message.getMessageProperties();
Long deliveryTag = messageProperties.getDeliveryTag();
String msgId = messageProperties.getMessageId();
logger.info("消息已到,message body is:{}", new String(message.getBody()));
RabbitMetaMessage rabbitMetaMessage = null;
boolean retry = false;
boolean success = false;
try {
rabbitMetaMessage = RabbitMetaMessageUtils.getRabbitMetaMessageWithPayload(message);
save(rabbitMetaMessage);
retry = receiveMessage(rabbitMetaMessage);
if (retry) {
messageRetry.retry(message, channel);
return;
}
// 成功的回执
channel.basicAck(deliveryTag, false);
success = true;
consumerSuccess(converSuccessObject(rabbitMetaMessage));
updateConsumerSuccess(rabbitMetaMessage, true);
} catch (Throwable e) {
if (success) {
logger.error("执行consumerSuccess出错 messageId = {}, throwable = {}", msgId, e);
return;
}
logger.error("RabbitMQ 消息消费失败," + e.getMessage(), e);
updateConsumerSuccess(rabbitMetaMessage, false);
// 消费失败
try {
retry = consumerFaile(converFailObject(rabbitMetaMessage, e));
} catch (Throwable throwable) {
logger.error("执行consumerFaile 出错 messageid= {}, throwable = {}", msgId, throwable);
retry = true;
}
// 继续重试
if (retry) {
try {
messageRetry.retry(message, channel);
} catch (Throwable throwable) {
//rabbit 本身出现异常就让消息阻塞
logger.error("重试异常 e= {}", throwable);
}
} else {
// 不需要重试
try {
if (channel.isOpen()) {
channel.basicAck(message.getMessageProperties().getDeliveryTag(), false);
}
} catch (IOException e1) {
//rabbit 本身出现异常就让消息阻塞
logger.error("消息确认异常 e = {}", e1);
}
}
}
} |
The code for the confirmation message is uniform, and other applications do not have this exception |
You are still not providing me with the information I need to help you. I need to see the stack trace that includes
which should be somewhere before the trace you are showing me. One more time; please post the log from before any issues until after the last stack trace. This error has nothing to do with the onMessage method; it is on the publisher side where some failure to process the publisher confirm occurred. |
I have found one possible condition where this might happen. |
Resolves spring-projects#849 Add defensive catch blocks; we currently catch exceptions in user `handleConfirm` calls, but not for returns, or for the code that determines which listener to call. Throwing exceptions to the client causes the channel to be killed.
Resolves #849 Add defensive catch blocks; we currently catch exceptions in user `handleConfirm` calls, but not for returns, or for the code that determines which listener to call. Throwing exceptions to the client causes the channel to be killed.
Resolves #849 Add defensive catch blocks; we currently catch exceptions in user `handleConfirm` calls, but not for returns, or for the code that determines which listener to call. Throwing exceptions to the client causes the channel to be killed. # Conflicts: # spring-rabbit/src/main/java/org/springframework/amqp/rabbit/support/PublisherCallbackChannelImpl.java
The environment is spring-amqp:2.0.8,amqp-client:5.4.3. So,does anyone know the possible reason?
The text was updated successfully, but these errors were encountered: