This topic describes terms that are related to Message Service (MNS) queues. You can familiarize yourself with related terms and use MNS queues based on your needs.
- The Alibaba Cloud account that is identified by the account ID.
- The destination address where messages are stored. Queues are sorted into standard queues and delayed queues. A message contains the message content and related parameters. Messages are sorted into standard messages and delayed messages. A message ID or receipt handle can uniquely identify a message in a queue.
- standard queue
- If you do not specify the DelaySeconds parameter when sending a message to a standard queue, the message will be consumed immediately.
- delayed queue
- If you specify the DelaySeconds parameter when sending a message to a delayed queue, the message cannot be consumed until the specified delay period ends. You can use the CreateQueue and SetQueueAttributes operations to specify the message delay period of a queue.
- queue owner
- After activating MNS, you can use the CreateQueue operation to create a queue. Your Alibaba Cloud account is the owner of the queue. A queue owner is authorized to perform all operations on the queue. You can view the account ID of a queue owner on the Alibaba Cloud official website.
- producer or publisher
- The client that sends messages to a queue.
- consumer or subscriber
- The client that receives messages from a queue.
- The access endpoint of MNS. Syntax:
Regionspecifies the region where MNS is deployed. You can specify a region based on your needs.
AccountIdspecifies the account ID of a queue owner. You must replace AccountId with the actual account ID when you call API operations.
- standard message
- The message that can be immediately consumed after being sent to a queue.
- delayed message
- The message that cannot be consumed until the specified delay period ends after the message is sent to a queue. You can specify the message delay period by using the DelaySeconds parameter. For more information, see SendMessage.
- message ID
- A message ID is used to identify a message in a queue. Each message in a queue has a unique message ID and messages in different queues may have the same message ID. When a message is sent to a queue, MNS generates a message ID. The message ID cannot be changed and is returned in the response. You can use the message ID to verify data. To delete a message, you must use the receipt handle.
- receipt handle
- A receipt handle is the temporary message identifier that is generated when a message
is consumed. A receipt handle is different from a message ID in concept. To delete
a consumed message or modify the value of the VisiblityTimeout parameter, you must use a receipt handle.
A receipt handle can be used only once. If the status of a message changes, the receipt handle expires. If the receipt handle expires and you want to delete the message or modify the value of the VisibilityTimeout parameter, you must receive the message again to retrieve a new receipt handle.
- message status
- The following section describes the status of a standard message:
- When a standard message is sent to a standard queue, the initial status of the message is Active. After the message is consumed, the status switches to Inactive and remains Inactive within the period that is specified by the VisibilityTimeout parameter. After the specified period ends, the status of the message switches to Active. If the message is deleted within the specified period, the status of the message switches to Deleted.
- When a standard message is sent to a delayed queue, the initial status of the message is Delayed. After the period that is specified by the DelaySeconds parameter ends, the status of the message switches to Active.
The following section describes the status of a delayed message:
- When a delayed message is sent to a queue (a standard queue or a delayed queue), the initial status of the message is Delayed. After the period that is specified by the DelaySeconds parameter ends, the status of the message switches to Active.
The maximum retention period of a message is specified by the MessageRetentionPeriod parameter. After the specified period ends, the status of the message switches to Expired and is collected by the garbage collector.
Only messages in the Active state can be consumed.
The following figure shows the lifecycle of a message.