• Distributed Message Service

  1. Help Center
  2. Distributed Message Service
  3. User Guide
  4. Introduction
  5. Best Practices

Best Practices

This section describes how to get the most out of DMS.

When using DMS, there are some measures you can take to improve API call efficiency, as well as message sending and retrieval efficiency. During message sending and retrieval, DMS, producers, and consumers collaborate to ensure service reliability. Best practices for producers and consumers of DMS are as follows:

  • If exceptions occur during sending, the producer will not receive the ACK. In this case, the producer decides whether to re-send messages.

    Each time the producer sends a message, it waits for an API response to confirm whether the message is successfully sent. If an exception occurs when sending the message, the producer will not receive a success response and it needs to decide whether to re-send the message. If a success response is received, it indicates that the message has been reliably stored into DMS.

  • After retrieving messages, the consumer acknowledges whether they have been retrieved successfully.

    During message retrieval, the consumer obtains messages stored in DMS. After the consumer retrieves the messages, it records the message retrieval status as successful or failed. It then submits the retrieval status to the DMS. Based on the retrieval status, DMS determines whether to retrieve the next batch of messages or retrieve the unsuccessfully retrieved messages again.

    During this process, the message retrieval status may not be successfully submitted due to exceptions. In this case, the corresponding batch of messages will be re-obtained by the consumer in the next message retrieval request.

  • Creating different consumer groups to locate faults or debug interoperability between new and existing services

    You can use DMS as a message management system. Reading message content from queues is helpful to fault locating and service debugging. To ensure that other services can continue to process messages in queues, you can create a consumer group and let the new consumer group retrieve and analyze messages in queues.

  • Batch message sending and retrieval

    To improve the efficiency of message sending and retrieval, you are advised to use the batch message sending and retrieval mode, which can effectively lower the number of API calls and minimize service fees.

    During batch message retrieval, if one message fails to be retrieved, the consumer should not process it or subsequent messages, because this message and subsequent messages will be re-sent.


    The DMS console does not support batch message sending, but sends one message per time instead.