0

我使用 spring boot 2.5.3 版、spring-cloud-stream-binder-kafka-stream 3.1.3 版和 kafka-clients 2.8.0 版。我想对 kafka 流中的未捕获异常处理程序使用 REPLACE_THREAD 选项。

但我无法使用它,因为 StreamsBuilderFactoryBeanConfigurer(2.6.7 版本)不支持 fb.setUncaughtExceptionHandler(ex -> { log.error("Uncaught exception: ", e); snsService.publish("UncaughtException thrown"); return StreamsUncaughtExceptionHandler.StreamThreadExceptionResponse.REPLACE_THREAD; });

是否可以用 替换流线程fb.setUncaughtExceptionHandler(new Thread.UncaughtExceptionHandler()

提前致谢!

4

1 回答 1

0

Springboot 版本应大于 2.6 以支持 kstreams 中的 REPLACE_THREAD。 https://spring.io/projects/spring-kafka#:~:text=Spring%20Boot%202.4%20users%20should,will%20use%20the%20correct%20version)。

于 2021-08-16T07:45:16.927 回答