Steven Matthews
Steven Matthews

Reputation: 11265

Trying to get message via message id and Boto

I am trying to get a message via a message id by using Boto.

This question:

Trying to Get SQS Message ID with Boto

Makes me think that Boto might have a way to get a message by a message id, but I can't find anything in the Boto documentation.

Is there anyway to get a message via message id?

Upvotes: 1

Views: 1931

Answers (2)

efirat
efirat

Reputation: 3867

I dont know what exactly your problem is, however, in my case:

I am getting about 20 messages at once from Sqs and processing them asyncronously. When a message done, I want to delete it from sqs. So, I put the progressing message to a HashMap with Id value.

When I am done with message I get it from Map easily.

If you have Id of message, you should also have Message object before. And If the range of Message count is not so much you can also use Maps.

 Message msg = onProcess.get(processId);
 sqs.deleteMessage(new DeleteMessageRequest().withQueueUrl(queueUrl).withReceiptHandle(msg.getReceiptHandle()));
 onProcess.remove(processId);

Upvotes: 0

garnaat
garnaat

Reputation: 45846

No, there isn't. The SQS API does not provide a way to retrieve a message body given a message id. All you can do is read messages from the queue.

The question you link to is about how to get the message ID from a message that you have already read. That is possible and the details can be found in that message.

Upvotes: 2

Related Questions