How to properly handle IOException for basicAck on RabbitMQ Channel when using Spring AMQP?

Viewed 624

When having declared a method like this using Spring AMQP:

@RabbitListener(..)    
public void myMethod(@Header(AmqpHeaders.CHANNEL) Channel channel, @Header(AmqpHeaders.DELIVERY_TAG) Long tag, ...)

and using manual acknowledge mode, how should one properly deal with the IOException that may be thrown when doing ACK:

try {
    channel.basicAck(tag, false);
} catch (IOException e) {
  // What to do here?
}

Should the exception be rethrown? Should the "basicAck" operation be retried? What's the proper way to handle it?

1 Answers
Related