All Products
Search
Document Center

Simple Message Queue (formerly MNS):Queue

Last Updated:Jan 02, 2025

This topic provides an overview of queues in Simple Message Queue (SMQ, formerly MNS), covering their definition, relationship with other components, properties, and limits.

Definition and relationship with other components

In SMQ, a queue is a container that stores messages. Producers send messages to queues, and consumers consume messages from queues.

image

Features

  • At-least-once delivery: Each message, within its retention period and maximum delivery attempts, is received and processed by a receiver at least once.

  • Batch processing: Messages can be sent, received, and deleted in batches, with up to 16 messages per batch.

  • Long polling: You can receive messages by using long polling to reduce the number of requests and save costs. The maximum wait time for long polling is 30 seconds. For more information, see Short polling and long polling.

  • Message invisibility duration: After a consumer receives a message, the message becomes invisible to other consumers in the queue for the specified duration. This prevents a message from being processed by multiple consumers at a time. If message processing fails or the message invisibility duration expires, the message can be consumed by another consumer.

Queue properties

Queue name

  • Description: the name of the queue, which is the globally unique identifier of the queue in a cluster.

  • Value: The name must be up to 120 characters in length and can contain letters, digits, and hyphens (-). It must start with a letter or digit.

Maximum message size

  • Description: the maximum size of the message body that can be sent to the queue. Unit: KB.

  • Valid values: 1 to 64.

Long polling period

  • Description: the wait time for long polling. If this property is set to 0, long polling is disabled. If this property is set to a non-zero value, long polling is enabled. In this case, the system returns a response to a message consumption request only after a valid message is consumed or long polling times out. Unit: seconds.

  • Valid values: 0 to 30.

Message visibility timeout period

  • Description: the duration for which a message remains in the Inactive state after it is consumed from the queue. If the message is not consumed by a client within the specified duration, the message restores from the Inactive state to the Active state. In this case, the message may be repeatedly delivered. Therefore, you must set this property to an appropriate value that aligns with the actual message processing time. Unit: seconds.

  • Valid values: 1 to 43200, which indicates 1 second to 12 hours.

Message retention period

  • Description: the maximum period during which a message is retained in the queue. If the specified retention period expires, the message is deleted, regardless of whether it is consumed. Unit: seconds.

  • Valid values: 60 to 604800, which indicates 1 minute to seven days.

Message delay time

  • Description: the default delay period after which all messages sent to the queue are consumed. Unit: seconds.

  • Valid values: 0 to 604800, which indicates 0 seconds to seven days.

Whether to enable logging

  • Description: specifies whether to enable the logging feature for the queue. If the logging feature is enabled, SMQ automatically pushes the operation logs of the queue to the specified logging bucket. You can then view the message trace, delay, and other information from the logs. For more information, see Log management.

  • Valid values: true and false.

Limits

Item

Limit

Description

Name length

120 characters

If this limit is exceeded, the queue fails to be created.

Number of queues

1,000

Note

If you require more queues, you can log on to Quota Center console and submit an application to increase the Maximum Queue Quantity in a Single Region. For more information, see Submit an application to increase a quota.

None.

Message size

64 KB

If this limit is exceeded, the message is discarded.

Batch operations on messages

16

None.

Long polling

30 seconds

None.

Message retention period

Seven days

We recommend that you specify a message retention period based on your business requirements. After the specified period expires, the message is deleted.