All Products
Search
Document Center

Simple Message Queue (formerly MNS):Message visibility

Last Updated:Oct 25, 2024

This topic describes the visible and invisible states, and visibility timeout period of messages. It also explains how to set the visibility timeout period in Simple Message Queue (SMQ, formerly MNS).

Visible and invisible states

image
  • Visible: A visible message can be read and received by numerous consumers. A consumer is a service or application that receives and processes messages.

  • Invisible: After a message is received by a single consumer, it becomes invisible and cannot be received by other consumers. This prevents other consumers from processing the same message.

Visibility timeout period

image

Visibility timeout period: The period from when a message is received by a consumer (invisible to other consumers) to when it can be received by other consumers again (visible to other consumers).

Set the visibility timeout period

Console

When creating and editing a queue, you can set Visibility Timeout Period. Valid values: 1 to 143200 seconds (12 hours). Default value: 30 seconds. For more information, see Create a queue.

API

You can also call the ChangeMessageVisibility operation in the client to modify the visibility timeout period based on your business requirements. For more information, see ChangeMessageVisibility.

Note

Set the visibility timeout period to a reasonable value to ensure smooth message consumption.

If you specify a long period, such as 12 hours, other consumers will have to wait 12 hours before they can consume the messages, even if the current consumer cannot delete the messages promptly due to application errors, crashes, or connection failures.