spring integration amqp channel error handler auto ack

I have an amqp-backed channel <int-amqp:channel> to temporarily persist messages coming from a JDBC inbound adapter. when no exception is thrown, the message is ack'd and removed from the rabbit queue. when an exception occurs, the message is returned to the queue and is reprocessed continuosly. There are some circumstances where I'd like the request to go back to the queue, but in most cases I just want to log the error and acknowledge the request (remove from the rabbit queue).

I've implemented an errorHandler to deal with thrown exceptions and allow for logging and "successful" completion, however even after handling, the original request is redelivered to the rabbit queue (unacknowledged)

in the inbound-rabbit-adapter, there is a property for error-channel and handling the message on the errorChannel allows me to achieve the desired behavior described above. the only error property on the amqp channel is errorhandler.

any suggestions on a configuration that would allow me to meet my requirements?

thanks


Throw an AmqpRejectAndDontRequeueException . See 3.9 Exception Handling.

The default error handler does that for message conversion exceptions (which are likely irrecoverable).

In fact you can use that error handler by injecting a custom FatalExceptionStrategy .

链接地址: http://www.djcxy.com/p/34100.html

上一篇: rabbitmq amqp版本与Qpid 6.0.0协商失败

下一篇: spring集成amqp通道错误处理程序auto ack