Closed cody-greene closed 1 year ago
A ConsumerHandler can return a status code for precise control of ack/nack behavior. An enum type is provided for convenience, but it's not necessary.
import {ConsumerStatus} from 'rabbitmq-client' const sub = rabbit.createConsumer({ queue: 'my-queue', requeue: false // behavior with exceptions }, async (msg) => { // optionally return a status code // 0 or undefined - ack // 1 - nack(requeue=true) // 2 - nack(requeue=false) return ConsumerStatus.REQUEUE // 1 })
fixes #20
A ConsumerHandler can return a status code for precise control of ack/nack behavior. An enum type is provided for convenience, but it's not necessary.