Redningsselskapet / nestjs-plugins

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

How i can check ack? #32

Closed cyc1e closed 1 year ago

cyc1e commented 2 years ago

Hi! A lot of thanks for youre work! I have issuse:

this code

this.natsClient
  .emit<DataResponse>('entity.created', {
  success: true,
  dataResponse,
  message: 'Ok',
  })
  .subscribe((pubAck: PubAck) => {
  console.log('pubAck', pubAck)
})

return everetime message like this pubAck { stream: 'mystream', seq: 22, duplicate: false }

even though i didn't ack this and the same if i did I dont understan how i can check ack

my config

        connectionOptions: {
                servers: 'nats://0.0.0.0:4222',
                name: 'listener',
                timeout: 2000,
            },
            consumerOptions: {
                deliverGroup: 'group',
                deliverTo: 'group',
                manualAck: true,
                ackPolicy: 'None',
                deliverPolicy: 'Last',
            },
            streamConfig: {
                name: 'mystream',
                subjects: ['entity.*'],
            },

I stuck in this

kenguru33 commented 1 year ago

You do not acknowledge a published message. You only do that when a client consume a message, manually or automatically.

Whe you publish a message, the promise will resolve an object with a sequence number and a boolean value telling if the message was a duplicate or not.