spring cloud stream kafka binder allow/deny 是否可以重试特定异常?

Can spring cloud stream kafka binder allow/deny retry for specific exceptions?

是否可以将 属性 添加到 application.yml 到 include/exclude 某些例外情况以防止在下面定义的策略中重试?我发誓我在某处读到有一个 属性 用于此,但现在我再也找不到它了。任何帮助将不胜感激。

spring:
  cloud:
    stream:
      kafka:
        binder:
          brokers: localhost:9092
      bindings:
        topic-in:
          destination: topic
          contentType: application/json
          group: topic-group
          consumer:
            max-attempts: 3 
            backOffInitialInterval: 1000
            backOffMaxInterval: 1000
            backOffMultiplier: 3

请参阅文档 Retry Template

The RetryTemplate is part of the Spring Retry library. While it is out of scope of this document to cover all of the capabilities of the RetryTemplate, we will mention the following consumer properties that are specifically related to the RetryTemplate:

...

defaultRetryable

Whether exceptions thrown by the listener that are not listed in the retryableExceptions are retryable.

Default: true.

retryableExceptions

A map of Throwable class names in the key and a boolean in the value. Specify those exceptions (and subclasses) that will or won’t be retried. Also see defaultRetriable. Example: spring.cloud.stream.bindings.input.consumer.retryable-exceptions.java.lang.IllegalStateException=false.

Default: empty.

...

While the preceding settings are sufficient for majority of the customization requirements, they may not satisfy certain complex requirements at, which point you may want to provide your own instance of the RetryTemplate. To do so ...