I have integrated a API Gateway with FIFO SQS queue using below link https://medium.com/@pranaysankpal/aws-api-gateway-proxy-for-sqs-simple-queue-service-5b08fe18ce50
Below is the snippet of role policy
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "VisualEditor0",
"Effect": "Allow",
"Action": [
"sqs:SendMessageBatch",
"sqs:ReceiveMessage",
"sqs:SendMessage"
],
"Resource": "arn:aws:sqs:*:12345678:Stg"
}
]
}
Whenever is try to test it from API Gateway it throws below error:-
"Message": "The request must contain the parameter MessageGroupId."
So I tried to send it via query string but still the error persist.
I have followed the same steps as per the above link for body template and header.
MessageGroupId=098
Simply passing above value in query string and body is below
{"ty":"ui"}
Then, each message can be received and processed in the exact order in which the messages were transmitted. In FIFO queues, messages are ordered based on message group ID.
If multiple messages are sent in succession to a FIFO queue, each with a distinct message deduplication ID, Amazon SQS stores the messages and acknowledges the transmission. Then, each message can be received and processed in the exact order in which the messages were transmitted. In FIFO queues, messages are ordered based on message group ID.
But, if you want a highly scalable infrastructure that requires almost no maintenance from your team, AWS API Gateway and SQS can be combined fairly easily with a simple integration template.
Returns an instance of the iam.Role created by the construct for API Gateway for CloudWatch access. Returns an instance of the log group created by the pattern that API Gateway REST API access logs are sent to. Returns an instance of the IAM role created by the pattern for the API Gateway REST API.
You need to add MessageGroupId
, and MessageDeduplicationId
to the URL Query String Parameters in Method Execution. Same way you did for MessageBody
.
You'll also need to add MessageGroupId
, and MessageDeduplicationId
to Integration Request. Again the same way you did with MessageBody
.
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