ssut / nestjs-sqs

A project to make SQS easier to use within NestJS, with decorator-based handling and seamless NestJS-way integration.
MIT License
204 stars 54 forks source link

QUESTION: FIFO queue message still available after consumer fetch #52

Closed arashkevich25 closed 1 year ago

arashkevich25 commented 1 year ago

Hello, the first questiion why fifo queue still keep messages after consumer fetch it ?

@SqsMessageHandler(process.env.AWS_SQS_NAME, true)
  public async handleMessage(message: Message) {
    this.loggerService.verbose('New queue message');
    await this.appService.doSomething(message[0].Body);
  }

after finish handle it, the consumer fetch the same message again and again

Here is queue config

resource "aws_sqs_queue" "this" {
  name                      = var.queue_name
  delay_seconds             = 90
  max_message_size          = 2048
  message_retention_seconds = 1209600
  receive_wait_time_seconds = 10
  visibility_timeout_seconds = 0
  fifo_queue = true
}

if I change batch flag from true to false then consumer have a lot the same message without waiting handler finish.

// from
@SqsMessageHandler(process.env.AWS_SQS_NAME, true)

// to
@SqsMessageHandler(process.env.AWS_SQS_NAME, false)

What is wrong here?

my version "@ssut/nestjs-sqs": "^2.0.0",

Naya070 commented 1 year ago

Hi, how did you solve this?