Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

AWS SQS FIFO Queue: The queue should either have ContentBasedDeduplication enabled or MessageDeduplicationId provided explicitly?

When I try to add a message to my FIFO SQS using AWS CLI I get:

An error occurred (InvalidParameterValue) when calling the SendMessage operation: The queue should either have ContentBasedDeduplication enabled or MessageDeduplicationId provided explicitly

My Request:

C:\Windows\system32>aws sqs send-message --queue-url https://sqs.us-east-1.amazonaws.com/307125934878/myqueue.fifo --message-body "hello world" --region us-east-1 --message-group-id 3

How can I solve this?

like image 659
java12399900 Avatar asked Jun 30 '20 10:06

java12399900


People also ask

What is Messagededuplicationid in SQS?

The message deduplication ID is the token used for deduplication of sent messages. If a message with a particular message deduplication ID is sent successfully, any messages sent with the same message deduplication ID are accepted successfully but aren't delivered during the 5-minute deduplication interval.

How do I create a FIFO queue in AWS SQS?

Open the Amazon SQS console at https://console.aws.amazon.com/sqs/ . Choose Create queue. For Type, the Standard queue type is set by default. To create a FIFO queue, choose FIFO.

How do I enable the SQS queue?

Open the Amazon SQS console at https://console.aws.amazon.com/sqs/ . Choose Create queue. On the Create queue page, specify the correct region. The Standard queue type is selected by default.

Is SQS a FIFO queue?

Q: Does Amazon SQS provide message ordering? Yes. FIFO (first-in-first-out) queues preserve the exact order in which messages are sent and received.


1 Answers

You have to provide --message-deduplication-id or enable ContentBasedDeduplication for your queue:

You may provide a MessageDeduplicationId explicitly. If you aren't able to provide a MessageDeduplicationId and you enable ContentBasedDeduplication for your queue, Amazon SQS uses a SHA-256 hash to generate the MessageDeduplicationId using the body of the message (but not the attributes of the message).

The deduplication ID is:

the token used for deduplication of sent messages. If a message with a particular message deduplication ID is sent successfully, any messages sent with the same message deduplication ID are accepted successfully but aren't delivered during the 5-minute deduplication interval.

For the existing queue, you can enable it in its Configuration options:

enter image description here

like image 156
Marcin Avatar answered Oct 19 '22 19:10

Marcin