简体   繁体   中英

How to confirm delivery of Message to Amazon SQS Queue?

I am using AWS sdk for developing SQS based queue pub-sub.

In the very basic prototype, I am pushing messages concurrently to a queue I have already created. However, how can I be sure that my messages are being pushed to the queue ?

What is the guarantee that the messages pushed won't fail in the process, for whatever reason ?

Amazon API query provides for ResponseMetadata which has the RequestID associated with that particular send message request. Is getting that enough to surely confirm the pushing of message to the Queue ?

String requestId = sqs.sendMessage(request).getSdkResponseMetadata().getRequestId();

Does the Amazon sendmessage request not give a response body with Http Code ?

See SendMessageResult . There's a getMessageId() that should give you the message-id that was assigned to the message by SQS. If you get that, the message most certainly was delivered. The consumer of the message has access to this same ID when a message is received, and the ID is designed to be globally unique for an extended period of time .

AWS SendMessageRequest does send status code for each request for pushing messages which is being sent.

int statusCode =     sendMessageResult.getSdkHttpMetadata().getHttpStatusCode();

But this will fail for batch of messages being pushed as we will not know which ones in the batch has not been pushed successfully.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM