Queue

更新时间:
复制 MD 格式

A queue in Simple Message Queue (SMQ, formerly MNS) is a message container where producers send messages and consumers retrieve them.

image

Features

At-least-once delivery

Each message is delivered to a consumer at least once within its retention period and maximum delivery attempts. Because duplicate delivery is possible, design your consumers to handle the same message multiple times without side effects.

Batch operations

Send, receive, and delete up to 16 messages in a single API call. This reduces round trips and lowers request costs for high-throughput workloads.

Long polling

A receive request waits up to 30 seconds for a message to arrive before returning an empty response. This eliminates unnecessary polling cycles and reduces costs. For details, see Short polling and long polling.

Visibility timeout

After a consumer receives a message, the message becomes invisible to other consumers for a configurable duration. This prevents duplicate concurrent processing. The message returns to the Active state and may be redelivered in the following scenarios:

  • Processing fails: The consumer explicitly gives up the message.

  • Timeout expires: The consumer does not finish processing before the visibility timeout elapses.

  • Consumer crashes: The consumer process terminates before completing the message.

Set the visibility timeout to match or exceed the expected processing time of your consumer.

Queue properties

Property

Description

Valid values

Default

Unit

Queue name

Unique name for the queue within a region. Must start with a letter or digit. Can contain letters, digits, and hyphens (-).

Up to 120 characters

--

--

Maximum message size

Maximum size of the message body accepted by the queue.

1--64

[needs confirmation]

KB

Long polling period

Wait time for a receive request. 0 disables long polling (short polling). Any non-zero value enables long polling: the service returns a response only after a valid message arrives or the wait time elapses.

0--30

[needs confirmation]

Seconds

Message visibility timeout

Duration a message stays in the Inactive state after a consumer receives it. If processing fails or the timeout expires, the message returns to the Active state and may be redelivered. Set this value to match or exceed the expected processing time.

1--43,200 (1 second to 12 hours)

[needs confirmation]

Seconds

Message retention period

Maximum time a message is kept in the queue. After this period, the message is deleted regardless of whether it has been consumed.

60--604,800 (1 minute to 7 days)

[needs confirmation]

Seconds

Message delay time

Default delay applied to all messages sent to the queue. Messages are not available for consumption until the delay elapses.

0--604,800 (0 seconds to 7 days)

[needs confirmation]

Seconds

Logging

Enables or disables log collection for the queue. When enabled, SMQ pushes operation logs to a logging store where message traces, delays, and other operational data are available. For details, see Log management.

true, false

[needs confirmation]

--

Default values are not documented in the source. Verify the defaults listed above against the SMQ console or API before publishing.

Limitations

Resource

Limit

What happens

Queue name length

120 characters

Queue creation fails.

Queues per region

1,000

Queue creation fails. To request a higher quota, go to Quota Center and increase the Maximum Queue Quantity in a Single Region quota. For instructions, see Submit an application to increase a quota.

Message size

64 KB

The message is discarded.

Messages per batch operation

16

--

Long polling wait time

30 seconds

--

Message retention

7 days (604,800 seconds)

After the retention period expires, the message is deleted regardless of whether it has been consumed. Set a retention period that matches your business requirements.