Message Service (MNS)

A message queuing and notification service that facilitates smooth transfer of messages between applications

Alibaba Cloud Message Service is a distributed message queuing and notification service that supports concurrent operations to facilitate message transfer between applications and decoupled systems. Alibaba Cloud Message Service enables users to move data between distributed applications to achieve complex tasks, and build decoupled fault tolerant applications.

As a Pay-As-You-Go service, Message Service (MNS) does not require any upfront investment and saves you the hassle of owning and scaling your own messaging platform. Best of all the service is maintenance free.

Benefits

Secure
Provides multiple level security with authentication mechanisms.
Ensures messages are stored in queues and secured against unauthorized access
Customizable Queue Attribute Configuration
Allows you to personalize queuing attributes to support different application scenarios.
Supports customization for delay and prioritizes queues
Compatibility with RESTful APIs
You can easily build message queue and integrate it with other Alibaba Cloud services to build robust distributed deployments by accessing RESTful APIs
Concurrent Read/Write
Multiple producers and consumers can operate on the same message queue concurrently

Features

  • Simple

    Easy-to-use service with APIs such as SendMessage, ReceiveMessage, and DeleteMessage.


    Leverage benefits of standard HTTP RESTful interfaces with Alibaba Cloud Message Service.


    A maintenance-free service without any dependency on the platform.


    Compatible with other Alibaba Cloud services.

  • Delay Message

    Delay messages are supported.
    You can determine the delay duration using DelaySeconds parameter, which can be specified when you use SendMessage.

  • Delay Queue

    You can specify the delay duration of the queuing service by using CreateQueue and SetQueueAttribute.

  • Reliable

    Quickly backs up data across multiple Availability Zones ensuring 99.9999999% reliability.


    Leverages service availability up to 99.99%.


    Ensures successful message delivery within the valid period.

  • Diversity of Queue Attributes

    Offers a wide range of message queue service modes which you can personalize including, plain queuing, latency queuing and priority queuing. Try out over 40 products for free.

FAQs

1. What are the major functions of Alibaba Cloud Message Service?

Message Service can be used for the below application scenarios:

• You can integrate Alibaba Cloud Message Service with other products like Elastic Compute Service (ECS), Object Storage Service (OSS) to build reliable, fault tolerant and flexible applications.
• You can use Message Service as a working queue so that each message in the queue represents one task and completes one process. This way you can decouple the process and build more resilient applications. However, one or more ECS instances can read and execute multiple tasks from the queue
• You can also store notifications for major events in the service processes, where each event has one corresponding message in the queue. The application that needs to acquire an event can read and process the corresponding message.

2. How can Message Service be accessed from different regions?

Alibaba Cloud Message Service provides various endpoints to access it in various regions mentioned below:

Region Public Network Address Private Network Address
Hangzhou mns.cn-hangzhou.aliyuncs.com mns.cn-hangzhou-internal.aliyuncs.com
Qingdao mns.cn-qingdao.aliyuncs.com mns.cn-qingdao-internal.aliyuncs.com
Beijing mns.cn-beijing.aliyuncs.com mns.cn-beijing-internal.aliyuncs.com
Singapore mns.ap-southeast-1.aliyuncs.com mns.ap-southeast-1-internal.aliyuncs.com
US - West mns.us-west-1.aliyuncs.com mns.us-west-1-internal.aliyuncs.com/
Shenzhen mns.cn-shenzhen.aliyuncs.com mns.cn-shenzhen-internal.aliyuncs.com
Shanghai mns.cn-shanghai.aliyuncs.com mns.cn-shanghai-internal.aliyuncs.com

3. What kind of operations are supported by Alibaba Cloud Message Service?

Now, Alibaba Cloud Message Service supports the following operations:

Queue-related operations

• CreateQueue: Creates a new queue.
• SetQueueAttributes: Modifies attributes of a queue.
• GetQueueAttributes: Obtains attributes of an existing queue.
• DeleteQueue: Deletes an existing queue.
• ListQueue: Lists queues under one account.

Message-related operations

• SendMessage: Enables producer to send messages to the specified queue.
• BatchSendMessage: Enables producer to send messages to the specified queue in batches.
• ReceiveMessage: Enables consumer to consume messages in a queue.
• BatchReceiveMessage: Enables consumer to consume messages in the queue in batches.
• DeleteMessage: Deletes consumed message.
• BatchDeleteMessage: Deletes consumed messages in batches.
• PeekMessage: Enables consumer to view messages.
• BatchPeekMessage: Enables consumer to view messages in batches.
• ChangeMessageVisibility: Changes the time when a message that has been consumed is still in an inactive state and can be consumed again.

4. What are the advantages of Alibaba Cloud Message Service compared to other message queue systems?

Alibaba Cloud Message Service has the following advantages compared to building a message queue system or using a commercial or open source message and notification service to manage queues:

• You do not need to make large investments.
• You don’t need to engage as much hardware and management resources, which adds to your enterprise ownership cost.
• Your messages are safe in case of hardware failure using replication and redundant message storage option.
• You can easily make changes through Alibaba Cloud Management Console once you create a message, even in live deployments.

5. How can I get started with Alibaba Cloud Message Service?

• Create an Alibaba Cloud account.
• Subscribe to Alibaba Cloud Message Service online.
• You can now start performing basic messaging operations such as creating and deleting queues, receiving and sending messages using the Management Console.
• You can also refer to this Quick Start guide for step-by-step directions on how to use Alibaba Cloud Message Service Message Service through the Management Console.
• You can also utilize Message service APIs and SDKs to integrate message queue with your applications.

6. How is a message identified in the system?

A unique Message-ID is used to identify a message in a queue. When a message is sent to a Message Service queue, a Message-ID is generated which cannot be changed once generated.

7. What is long polling?

Long polling is a way of retrieving messages from queues. Long polling allows Message Service to wait until a message is available in the queue before sending a response. This helps to reduce the number of empty responses.

8. Does Message Queuing Service support long polling?

Yes, Message Service supports long polling.

Once the message is available, long polling can immediately retrieve the message in the Message Service queue in a simple and economical manner.

9. Does Message Service support message First-In-First-Out (FIFO)?

Yes, Message Service ensures that in most cases messages are consumed in a FIFO manner. However, some features of distributed message queues may not always allow messages to be consumed in the order they are sent.

10. Can Message Service work with other Alibaba Cloud services?

Message Service can work with other Alibaba Cloud services such as Elastic Compute Service (ECS), Object Storage Service (OSS), and Object Table Service to enable greater reliability and scalability for applications.

11. Here are common use cases of Message Service with other Alibaba Cloud products:

• Message Service can carry messages to applications running on ECS instances so messages are processed.
• The ECS instance can read the queue, process tasks, and then publish the result to another Message Service queue as a message (which may be further processed by other applications).
• ECS allows dynamic scalability of applications so developers can build in the elasticity for computing instances according to the volume of messages to maintain consistent performance.

12. How does Message Service ensure reliability of stored data?

Message Service stores all queues and messages in a network of highly reliable and available Alibaba Cloud data centers. All messages are stored on multiple servers in redundancy mode. In the case of server failure, messages can be fetched from the redundant pool of data.

13. How does Message Service ensure that no messages are lost or repeatedly consumed when multiple consumers access the same queue?

Each Message Service queue has the configurable ChangeMessageVisibility attribute (that is, invisibility duration of the message taken out from the queue). When one message is taken out from the queue, other consumers cannot obtain this message during its invisibility period.

• If you finish the consumption within the invisibility period, the temporary handle (ReceiptHandle) is used to delete the message.
• If you are not able to finish the consumption within the invisibility period, you can send a request to extend the invisibility period using (ChangeVisibilityTimeout). Otherwise, the message can be obtained by other consumers once the invisibility period expires.

14. How many times can each message be received using Message Service?

The system design of Message Service ensures that all the messages in your queue are consumed at least once. However, we recommend that you enhance fault tolerance of the application services, so no error or inconsistency occurs when the same message is processed many times.

15. How does Alibaba Cloud Message Service ensure security of the messages queues?

Alibaba Cloud Message Service offers secure and reliable identity authentication mechanisms to protect message queues from unauthorized access. Only Alibaba Cloud account owners can access the queues created by themselves.

16. How can I configure Message Service to support a longer message retention period?

To set the message retention period, use SetQueueAttributes to set the MessageRetentionPeriod attribute. This attribute specifies the retention time of a message in the Message Service queue. Now, the message retention period is 4 days by default. You can set MessageRetentionPeriod to a value between 1 minute and 15 days.

17. How long can a message be retained in the Message Service?

The default message retention period in Alibaba Cloud Message Service is 4 days. However, the retention period is configurable and can be set to any value between 1 minute and 15 days. Once the message retention period expires, your message will be deleted automatically.

18. How to configure Message Service to support larger messages?

To configure the maximum message size, use SetQueueAttributes to set the MaximumMessageSize attribute. This attribute specifies the bytes size of a message. It can be set to any value between 1KB and 64KB. If the message length exceeds 64KB, We recommend that you store the data in OSS and store only the access address of the data in Message Service.

19. What happens to a queue that contains no message for a long time?

Normally, Alibaba Cloud Message Service does not delete inactive queues. However, if your Message Service is suspended due to defaulting or other reasons, all your queues will be deleted.

20. Are queues with the same name in different regions the same?

No. Queues with the same name in different regions are independent from each other.

Upgraded Support For You

1 on 1 Presale Consultation, 24/7 Technical Support, Faster Response, and More Free Tickets.

1 on 1 Presale Consultation

Consulting by experienced cloud experts.Learn More

24/7 Technical Support

Extended service time from 10 hours 5 days a week to 24/7. Learn More

6 Free Tickets per Quarter

The number of free tickets doubled from 3 to 6 per quarter. Learn More

Faster Response

Shorten after-sale response time from 36 hours to 18 hours. Learn More
phone Contact Us