Redningsselskapet / nestjs-plugins

Plugins for NestJS framework
ISC License
27 stars 22 forks source link

Cannot see effect of manualAck #41

Closed subhro-h2 closed 1 year ago

subhro-h2 commented 1 year ago

Describe the bug Cannot see effect of manualAck.

To Reproduce As specified in the docs i am using the below configuration:

strategy: NatsJetStreamServer.

consumerOptions: {
        ackPolicy: 'All',
        deliverGroup: 'hh-identity-group',
        /*durable: process.env.IDENTITY_QUEUE_GROUP_NAME,*/
        deliverTo: `${process.env.IDENTITY_QUEUE_GROUP_NAME}`,
        **manualAck: true,**
        deliverPolicy: 'New',
        ackWait: 10,
      },

In the code of the consumer (@EventPattern)

await context.message?.ack()

If I comment out the above code, in the consumer, still messages are getting processed and getting auto acked. The consumer code is NOT returning anything.

Seems there is no effect of manualAck.

Expected behavior

Should not acknowledge the messages when manulAck is set to true and message is not acknowledged.

Server:

kenguru33 commented 1 year ago

I have tested with your code your example, but I am unable to reproduce this.

By setting manualAck to false, the consumer auto acknowledge the message. With it set to true, the message will be resent until you have the acknowledged the message.

To me everything seems to work as expected.

vlad-healthhelper commented 1 year ago

@kenguru33 when you reproduce this issue, how do you start NATS itself? Do you specifically set NoAck option?

kenguru33 commented 1 year ago

No. Just followed the readme