How to create Amazon SQS Long Polling?

Hello,

Question: How to create Amazon SQS Long Polling?
My target is made the cost lower.

About Amazon SQS Long Polling: Amazon SQS short and long polling - Amazon Simple Queue Service

I tried to add ReceiveMessageWaitTimeSeconds

MyQueue:
 Type: "AWS::SQS::Queue"
 Properties:
   QueueName: MyQueue
   ReceiveMessageWaitTimeSeconds: 20

And it has an effect on the settings:

Receive Message Wait Time: 20 seconds

But I still have a lot of NumberOfEmptyReceives: Screenshot by Lightshot .

1 Like

Did you ever get this figured out? I’m seeing a very similar trend with my sqs usage. Even when not in use at all, i’m getting avg. 99 NumberOfEmptyReceives a minute.

Hello @adam-t-b @andy265 . Did you find a way around this?

Anyone ever figure out a way to do this within the serverless.com configuration? Having the same issue…

I’ve found a way to enable long polling both for queue and dead letter queue (dlq).

constructs:
  my-queue:
    type: queue
    worker:
      handler: src/worker.handler
    extensions:
      queue:
        Properties:
          ReceiveMessageWaitTimeSeconds: 20
      dlq:
        Properties:
          ReceiveMessageWaitTimeSeconds: 20

References: