Queue is the destination storage of messages. Message consists of data and attributes. MessageId and ReceiptHandle are two types of indicator for an unique message in the queue.
The user ID of Alibaba Cloud Service.
The Account opened with Message Service uses CreateQueue API to create a queue, then the Account is the owner of the queue. The owner has all the rights of operations on the queue. The AccountID can be queried from the Alibaba Cloud WebSite.
The role of sending message to queue.
The role of receiving message and deleting message from queue.
The domain url to access Message Service in following format: “https://$AccoundId.mns.$Region.aliyuncs.com”
$Region is the location where Message Service deployed.
$AccountId is the user ID given by Alibaba Cloud Service when user register to use Alibaba Cloud Service.
The message sent to queue can be received by consumer at once.
The message sent to queue will be hidden some time before available for receiving by consumer.
The default message delay time is zero which means any message not set with delay seconds attribute is available for receiving at once.
The default message delay time is bigger than zero, which means any message not set with delay seconds attribute will be delayed by specified seconds before visible to the consumers.
The ID indicating a message is generated by Message Service when producer sends messeage request to the queue. Every message has an unique MessageID in the same queue. But the MessageID may be duplicated in different queues. And the MessageID can returns the response from Message Service but can not be used to delete a message.
ReceiptHandle is an temporary indicator. It is generated by Message Service and returned to consumers when they receiving messages. Consumers can use the ReceiptHandle to delete message or change visibility timeout of message. But the ReceiptHandle will expire if the message status changes.
There are three statuses for message in queue: Active, Delayed, Inactive.
Normal message is initialized with status Active. Delay message is initialized with status Delayed.
If the total time of the message stay on Delayed status reaches the delay time, it will transit into Active status.
If message in Active status is received by a consumer, the message status will transit to Inactive status and is not visible for consumers.
There is a visibility timeout for every Inactive message. If the Inactive message is not deleted by the consumer within the visibility timeout, the status will transit to Active and can be received by consumers again.
Both the message delay time and visibility timeout can be specified by user application.