简体   繁体   English

Spring Integration AMQP通道错误处理程序自动确认

[英]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.

相关问题 AMQP Spring Integration错误处理 - AMQP Spring Integration error handling Spring rabbitmq 如何在错误处理程序上手动确认,在抛出特定所需的异常时,只有在确认设置为 AUTO 时才会确认 - Spring rabbitmq how to do manually ack on Error handler , On throwing specific required exception, it only ack when Acknowledge is set to AUTO 向 prometheus 公开 spring 集成 amqp/jms 通道消息指标 - Expose spring integration amqp/jms channel messages metrics to prometheus RabbitMQ BasicAck 在控制台上提供通道关闭错误消息 - Spring AMQP - RabbitMQ BasicAck giving channel shutdown error messages on console - Spring AMQP 使用PollableChannel时的Spring集成错误通道 - Spring integration error channel when using PollableChannel 在 AMQP 的 Spring 集成中使用 ImmediateRequeueMessageRecoverer? - Use ImmediateRequeueMessageRecoverer in Spring Integration for AMQP? Spring Integration Error - Dispatcher没有通道订阅者 - Spring Integration Error - Dispatcher has no subscribers for channel Spring AMQP:希望将消息放入队列并立即发送ACK - Spring AMQP: would like to put message to queue and send ACK immediately 我可以从入站通道适配器处理程序中向Spring Integration Channel消息吗? - Can I Message Spring Integration Channel from within My Inbound Channel Adapter Handler? Spring Integration使用网关发送确认 - Spring integration send ack using gateway
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM