Updated on 2022-02-24 GMT+08:00

DMS Overview

Distributed Message Service (DMS) is a message middleware service using the distributed, high-availability clustering technology. It provides reliable, scalable, and fully managed queues for sending, receiving, and storing messages.

DMS queues serve as an interchange station to transmit messages among application components. With DMS, components that send messages and components that receive messages do not have to be available at the same time.

Figure 1 illustrates the process of creating and retrieving a message.

Figure 1 Flowchart for creating and retrieving a message
Table 1 Lifecycle of a message

Step

Description

1

The producer sends message M to a queue.

Message M is redundantly distributed in the queue.

2

Consumers retrieve message M from the queue.

While message M is being retrieved, it remains in the queue. It cannot be retrieved again within 30s since the start of retrieval. If message M is not acknowledged within this period, DMS determines the message retrieval to be unsuccessful, and message M can be retrieved again.

3

Once message M is acknowledged, it can no longer be retrieved by consumers from the same consumer group.

However, it can still be retrieved by consumers from other consumer groups. It remains in the queue for at least 72 hours (unless the queue is deleted) and will be deleted after this period.

If messages are retrieved using APIs, they must then be acknowledged using the ACK API. If messages are retrieved using the DMS console, they are automatically acknowledged.

As shown in Figure 2, DMS stores messages of a queue on different servers, and each message has multiple replicas, achieving high reliability and availability.

Figure 2 Distribution of messages in a queue

Message queues have the following characteristics:

  • Ordered message delivery

    Standard queues support partition-level and global FIFO.

    Partition-level FIFO queues provide higher concurrency, but cannot guarantee that messages are retrieved in the sequence they are received. If you want to preserve the message sequence, you are advised to put sequence information in each message, so that messages can be sequenced after they are received.

    Global FIFO queues support FIFO message delivery and are applicable to scenarios with high sequence requirements.

  • At-least-once delivery

    One of the servers storing message replicas may be unavailable when the client requests or deletes messages. If this happens, the message replicas will not be deleted from that server and may be sent again when the connection is restored.

    This process is called "at-least-once" delivery. Ensure that your application can process a message repeatedly while producing the same result.