Search code examples
apache-kafka-streamsspring-kafkauncaughtexceptionhandler

spring version 2.6.7 doesn't support REPLACE THREAD option in KStream


I use spring boot version 2.5.3, spring-cloud-stream-binder-kafka-stream version 3.1.3 and kafka-clients version 2.8.0. I want to use REPLACE_THREAD option for uncaught exception handler in kafka streams.

But I'm not able to use that since StreamsBuilderFactoryBeanConfigurer (2.6.7 version) doesn't support fb.setUncaughtExceptionHandler(ex -> { log.error("Uncaught exception: ", e); snsService.publish("UncaughtException thrown"); return StreamsUncaughtExceptionHandler.StreamThreadExceptionResponse.REPLACE_THREAD; });

Is it possible to replace the streams thread with fb.setUncaughtExceptionHandler(new Thread.UncaughtExceptionHandler()?

Thanks in Advance!


Solution

  • Springboot version should be greater than 2.6 to support REPLACE_THREAD in kstreams. https://spring.io/projects/spring-kafka#:~:text=Spring%20Boot%202.4%20users%20should,will%20use%20the%20correct%20version).