SQS is the simple queue service, which is a distributed Message Queue Service. It is very simple to use. The Message Queue Service can be used for buffer burst, so that the entire service can be processed asynchronously and components are not always available.
When using Amazon SQS, developers only need to use five APIs:
Createqueue, sendmessage, receivemessage, changemessagevisibility, and deletemessage.
Amazon SQS tries its best to maintain the order of messages, but due to the distributed nature of queues, it cannot guarantee the order of messages. It is precisely because these features are discarded that SQS's scalability can be maintained.
Each Amazon SQS queue has configurable visibility timeout (default visibility timeout ). The message remains invisible to other readers within the specified time after it is read from the queue. As long as the message processing time is shorter than the visibility timeout, each message is processed and deleted. If the component that processes the message fails or is unavailable, the message is visible to any component that reads the queue after the visibility timeout. This allows multiple components to read messages from the same queue at the same time. Each component is responsible for processing different messages. Therefore, this feature requires the application to be idempotent.
When Amazon SQS returns a message to you, the message is saved in the queue, whether or not you actually receive the message. You are responsible for deleting the message. The deletion request confirms that you have processed the message. If you do not delete a message, Amazon SQS delivers the message in another receiving request.
This is also possible because a server in the distributed Amazon SQS system is not available for deletion, and the deletemessage operation fails to delete all copies of the message. This message copy may be delivered again, so consider this when designing an application so that no errors or inconsistencies will occur when you receive the deleted message again.
If no request is issued for a queue for more than 30 consecutive days, SQS may delete the queue: sendmessage, receivemessage, deletemessage, getqueueattributes, and setqueueattributes. This should be taken into account when designing an application.
Original article: http://blog.csdn.net/hongchangfirst/article/details/25870323
Author: hongchangfirst
Hongchangfirst home: http://blog.csdn.net/hongchangfirst
Introduction to Amazon SQS