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?
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.
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.
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.
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.
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:
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