Search code examples
spring-cloud-aws

How do I apply a delay to messages on a FIFO SQS?


Using 'io.awspring.cloud:spring-cloud-starter-aws-messaging' how can we apply a per-queue delay to the messages in the queue?

When I do the following...

sqsTemplate.convertAndSend( "myqueue.fifo", myObject, Map.of(SQS_GROUP_ID_HEADER, id, SQS_DEDUPLICATION_ID_HEADER, UUID.randomUUID().toString(), SQS_DELAY_HEADER, 1 )

I see...

org.springframework.messaging.MessageDeliveryException: Value 1 for parameter DelaySeconds is invalid. Reason: The request include parameter that is not valid for this queue type.

https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-delay-queues.html


Solution

  • The delay is set on the FIFO itself not via the service consuming it. enter image description here