RetryListener not bound to consumer's RetryTemplate in Spring Cloud Stream functional model

75 views Asked by At

We have developed a RetryListener to log exceptions between every retry when we are consuming messages off of a stream and exceptions occur. I am trying to bind this listener into our consumer but am not seeing the expected logged error. It appears to me that any user-defined RetryListeners are not being picked up by the org.springframework.cloud:spring-cloud-stream-test-binder in our integration tests as I am not seeing the expected output logged. What do I need to do to get my RetryListener bound to the RetryTemplate created by the subclass of org.springframework.cloud.stream.binder.AbstractBinder? Also, if my RetryListener is not bound via the test binder, will it be with the Kinesis and Kafka binders?

For more context, here's what we used to have when we used @StreamListeners:

@Retryable(
      maxAttemptsExpression =
          "#{@properties.maxAttemptsExpression()}",
      backoff =
          @Backoff(
              delayExpression =
                  "#{@properties.delayExpression()}",
              multiplierExpression =
                  "#{@properties.multiplierExpression()}",
              maxDelayExpression =
                  "#{@properties.maxDelayExpression()}"),
      listeners = {"myListenerSupport"})

Now we have the following:

spring:
  application:
    name: my-message-processing-microservice
  cloud:
    function:
      definition: xyzConsumer
    stream:
      bindings:
        xyzConsumer-in-0:
          consumer:
            back-off-initial-interval: 1000
            back-off-max-interval: 10000
            back-off-multiplier: 2.0
            max-attempts: 3

Again, the question overall is how to I integrate my RetryListener into each consumer?

0

There are 0 answers