[英]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. 我有一个由amqp支持的通道<int-amqp:channel>
来临时保存来自JDBC入站适配器的消息。 when no exception is thrown, the message is ack'd and removed from the rabbit queue. 当没有抛出异常时,该消息将被确认并从Rabbit队列中删除。 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). 在某些情况下,我希望请求返回到队列,但是在大多数情况下,我只想记录错误并确认请求(从Rabbit队列中删除)。
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) 我已经实现了errorHandler来处理引发的异常,并允许记录和“成功”完成,但是即使在处理之后,原始请求也会重新传递到Rabbit队列(未确认)
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. 在inbound-rabbit-adapter中,有一个错误通道属性,通过在errorChannel上处理消息,我可以实现上述期望的行为。 the only error property on the amqp channel is errorhandler. amqp通道上唯一的错误属性是errorhandler。
any suggestions on a configuration that would allow me to meet my requirements? 对配置有什么建议可以使我满足要求吗?
thanks 谢谢
Throw an AmqpRejectAndDontRequeueException
. 抛出一个AmqpRejectAndDontRequeueException
。 See 3.9 Exception Handling . 参见3.9异常处理 。
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
. 实际上,您可以通过注入自定义FatalExceptionStrategy
来使用该错误处理程序。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.