edit-icon download-icon

Message status is "Consumed", but the Consumer has not received it.

Last Updated: Feb 24, 2018

The message status is “Consumed”, but the service log of the Consumer indicates that the message has not been received. This problem is usually caused by one of the following reasons:

  • The service code does not print the message immediately after receiving it.

    If proceeding to the service logic immediately after receiving a message, and if a logic branch is missed by the code, the message information does not get stored in the service log, which is why it seems that the message has not been received.

    After receiving a message, please immediately print the message information, and save the messageId, timestamp, reconsumeTime, and so on.

  • Multiple consumption instances have been deployed on the Consumer

    It is inevitable that the Consumer may be restarted for multiple times, especially during the debugging sTage. Once multiple consumption processes exist simultaneously (the process is not terminated), multiple consumption instances will share the message information like in the clustering consumption mode. The seemingly not-received message is actually received by another Consumer.

    Go to the MQ console, choose Consumers > Consumer Status > Connection Status, and then check the consumer’s instance deployment information (the number of consumption instances, their respective IP addresses, and so on) to troubleshoot.

  • An exception that has not been caught occurred during the message consumption, causing the message to be retransmitted.

  1. public class MessageListenerImpl implements MessageListener {
  2. @Override
  3. public Action consume(Message message, ConsumeContext context) {
  4. //The message processing logic throws an exception. The message will retry.
  5. doConsumeMessage(message);
  6. //If an exception that has not been caught occurred in doConsumeMessage(), log of this row will not be printed.
  7. log.info("Receive Message, messageId:", message.getMsgID());
  8. return Action.CommitMessage;
  9. }
  10. }

If the problem persists, please contact Alibaba Cloud After-Sales Technical Support and provide the local SDK log.

Thank you! We've received your feedback.