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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With