I'll-Be-Back
I'll-Be-Back

Reputation: 10828

Step functions - read from SQS?

There will be thousands of messages in the SQS.

Is it possible in the Step functions wait until OrderId:123 (json) is in the SQS and then execute the Lambda function when specific Order Id is received?

Edit: Step Functions to call the Lambda function at regular intervals until it manages to retrieve a message with a particular attribute. OrderId attribute will be in the body message. For example:

{
  "OrderId": 1235,
  "Items": [{"Id":1, "Name": "Item 1"}]
}

Upvotes: 1

Views: 4014

Answers (1)

John Rotenstein
John Rotenstein

Reputation: 269081

No, it is not possible to selectively retrieve a message from Amazon SQS.

Your application can request to receive 1-10 messages from SQS, but cannot request specific messages.

See: Finding certain messages in SQS

You could use send the messages to Amazon SNS instead and then Filter Messages with Amazon SNS using attributes, and also subscribe the SQS queue to the SNS topic to send a copy of the message to SQS, but this is starting to get too complicated.

You should probably re-architect the solution to have incoming orders trigger the next activity, rather than searching for a given order response.

Upvotes: 2

Related Questions