在批处理模式下弹簧云流中的错误处理
我正在使用Spring Cloud Stream和Kafka活页夹中的批次批量消费消息。我正在尝试实施错误处理机制。根据我的理解,我无法在批处理模式下使用Spring Cloud Stream的enabledlq
属性。
我找到了enctioningBatcherrorhandler
和deadletterPublishingRecoverer
重试并从Spring-Kafka文档发送故障消息。但是我无法理解如何按照功能编程标准将记录发送到自定义DLQ主题。我可以看到的所有示例都是使用kafkatemplates。
有什么好例子可以找到实现吗?
这是我所指的春季文档。
https://docs.spring.io/spring-kafka/docs/2.5.12.release/referene/reference/html/#recovering-batch-eh
I am using Spring Cloud Stream and Kafka Binder to consume messages in batches from a Kafka Topic. I am trying to implement an error handling mechanism. As per my understanding I can't use Spring Cloud Stream's enableDLQ
property in batch mode.
I have found RecoveringBatchErrorHandler
and DeadLetterPublishingRecoverer
to retry and send failure messages from the spring-kafka documentation. But I am not able to understand how to send the records to a custom DLQ topic following the functional programming standards. All the examples I can see is using KafkaTemplates.
Are there any good example where I can find the implementation?
This is the spring doc I have been referring to.
https://docs.spring.io/spring-kafka/docs/2.5.12.RELEASE/reference/html/#recovering-batch-eh
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
该版本不再被支持为OSS https://spring.io oio oio oi o支持
使用当前版本,请使用
defaulterrorhandler
用deadletterPublishingRecoverer
配置并投掷batchlistenerexcecutionfailedexception
告诉批次记录的框架。参见 https://docs.spring.io/spring-kafka/docs/current/referent/referent/html/#annotation-error andling /spring-kafka/docs/current/reference/html/#dead-letters'' rel =“ nofollow noreferrer”> https://docs.spring.io/spring-kafka/docs/current/referent/referent/html/#dead-letters href =“ https://docs.spring.io/spring-kafka/docs/current/referent/referent/html/#legacy-eh” rel =“ nofollow noreferrer“> https://docs.spring.io/spring-kafka/docs/current/current/referent/reference/html/#legacy-eh
添加
linecerercontainercustomizer
给听众容器。That version is no longer supported as OSS https://spring.io/projects/spring-kafka#support
With the current version, use the
DefaultErrorHandler
configured with aDeadLetterPublishingRecoverer
and throw aBatchListenerExcecutionFailedException
to tell the framework which record in the batch failed.See https://docs.spring.io/spring-kafka/docs/current/reference/html/#annotation-error-handling and https://docs.spring.io/spring-kafka/docs/current/reference/html/#dead-letters and https://docs.spring.io/spring-kafka/docs/current/reference/html/#legacy-eh
Add a
ListenerContainerCustomizer
bean to add your configured error handler to the listener container.