maxAttempts is not getting overridden with @StreamRetryTemplate

Viewed 156

I am using spring-cloud-stream 3.2.2 with kafka binder and I am defining a custom retryTemplate to override the default maxAttempts (3) and disable retrying

  @StreamRetryTemplate
  public RetryTemplate retrier() {
    var retry = new RetryTemplate();
    retry.setRetryPolicy(new SimpleRetryPolicy(1, new HashMap<>()));
    return retry;
  }

But when an exception occurs in the consumer still retries 3 times instead of just 1 time

enter image description here

the custom retryTemplate bean doesn't get injected

enter image description here

enter image description here

1 Answers
Related