0x4b53/amqp-rpc

Handle when user wants to Nack or Reject

akarl opened this issue · 1 comments

akarl commented

Right now we automatically ack the message after we have executed the handler. But when the user want's to reject the message because of an error?

func handler(c context.Context, rw *server.ResponseWriter, d amqp.Delivery) {
    result, err := SomeFunction()
    if err != nil {
        // Ok, we couldn't handle whatever this was.
        // But we have configured RabbitMQ to use a Dead Letter Queue.
        d.Nack(false, false)
    }
}

Should we force the user to always Ack or Nack the message in the handler? That way if they've also set autoAck they won't need to.

I made a comment in #30 about this, you don't think NotifyConfirm can help us?