在批处理模式下弹簧云流中的错误处理

发布于 2025-02-13 07:31:08 字数 648 浏览 1 评论 0原文

我正在使用Spring Cloud Stream和Kafka活页夹中的批次批量消费消息。我正在尝试实施错误处理机制。根据我的理解,我无法在批处理模式下使用Spring Cloud Stream的enabledlq属性。

我找到了enctioningBatcherrorhandlerdeadletterPublishingRecoverer重试并从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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

潜移默化 2025-02-20 07:31:08

该版本不再被支持为OSS https://spring.io oio oio oi o支持

使用当前版本,请使用defaulterrorhandlerdeadletterPublishingRecoverer配置并投掷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 a DeadLetterPublishingRecoverer and throw a BatchListenerExcecutionFailedException 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文