This topic describes how MNS prevents message loss or repeated consumption when multiple clients attempt to retrieve a message from a queue at the same time.

The VisibilityTimeout parameter can be configured for each MNS queue. The VisibilityTimeout parameter specifies the invisibility period of a message after a consumer client retrieves the message.

After a message is retrieved from the queue, the status of the message changes from Active (visible) to Inactive (invisible). Within the invisibility period, other consumer clients cannot retrieve the message.

  • If the message is consumed within the invisibility period, the consumer client must delete the message by using the receipt handle.
  • If the message is not consumed within the invisibility period, the consumer must send a ChangeVisibilityTimeout request to extend the invisibility period. Otherwise, when the invisibility period expires, the status of the message changes from Inactive (invisible) to Active (visible) and other consumer clients can retrieve the message.