Kafka Streams binder uncaught exception changes

The default StreamsUncaughtExceptionHandler is added only if the
application does not provide one.
This commit is contained in:
Soby Chacko
2022-03-03 14:36:05 -05:00
parent 922f735306
commit 090acc408f
2 changed files with 5 additions and 3 deletions

View File

@@ -21,7 +21,7 @@
</scm>
<properties>
<java.version>1.8</java.version>
<spring-kafka.version>2.8.2</spring-kafka.version>
<spring-kafka.version>2.8.4-SNAPSHOT</spring-kafka.version>
<spring-integration-kafka.version>5.5.8</spring-integration-kafka.version>
<kafka.version>3.0.0</kafka.version>
<spring-cloud-stream.version>3.2.3-SNAPSHOT</spring-cloud-stream.version>

View File

@@ -96,8 +96,10 @@ public class StreamsBuilderFactoryManager implements SmartLifecycle {
// By default, we shut down the client if there is an uncaught exception in the application.
// Users can override this by customizing SBFB. See this issue for more details:
// https://github.com/spring-cloud/spring-cloud-stream-binder-kafka/issues/1110
streamsBuilderFactoryBean.setStreamsUncaughtExceptionHandler(exception ->
StreamsUncaughtExceptionHandler.StreamThreadExceptionResponse.SHUTDOWN_CLIENT);
if (streamsBuilderFactoryBean.getStreamsUncaughtExceptionHandler() == null) {
streamsBuilderFactoryBean.setStreamsUncaughtExceptionHandler(exception ->
StreamsUncaughtExceptionHandler.StreamThreadExceptionResponse.SHUTDOWN_CLIENT);
}
// Starting the stream.
final Map<StreamsBuilderFactoryBean, List<ConsumerProperties>> bindingServicePropertiesPerSbfb =
this.kafkaStreamsBindingInformationCatalogue.getConsumerPropertiesPerSbfb();