The message status is "Consumed", but the service log on the consumer shows that no message has been received.

The possible causes are as follows:

  • After receiving the message, the service code does not immediately print the message.

    Assume that the service logic is directly executed after a message is received, and the code misses a certain logic branch. In this case, the message information is not recorded in the log, which leads to the false symptom that the message is not received.

    After receiving a message, we recommend that you print the message information immediately to keep the messageId, timestamp, and reconsumeTime.

  • Multiple consumer instances are deployed.

    Restarting the consumer multiple times is unavoidable, especially during the debugging stage. When multiple consumption processes coexist (the previous process is not terminated before the next is started), multiple consumer instances share the message information, similar to the clustering consumption pattern. A message that fails to be received by a consumer is actually received by another consumer.

    Log on to the Message Queue for Apache RocketMQ console. Choose Groups > Consumer Status > Connection Status. The consumer instance deployment information is displayed, such as the number of consumer instances and connection IP address of each instance. Check the displayed information and handle the fault accordingly.

  • In the consumption process, messages are not caught and therefore are re-delivered.
    public class MessageListenerImpl implements MessageListener {
        @Override
        public Action consume(Message message, ConsumeContext context) {
            //The message processing logic throws an exception. The message will retry.
            doConsumeMessage(message);
            //If an exception that has not been caught occurs in doConsumeMessage(), this row of log is not printed.
            log.info("Receive Message, messageId:", message.getMsgID());
            return Action.CommitMessage;
        }
    }

If the problem persists, submit a ticket and provide the local SDK log.