Search code examples
spring-cloud-streamspring-cloud-stream-binderspring-cloud-stream-binder-kinesis

Spring Cloud Stream Binder for AWS Kinesis not honoring some Spring Cloud Stream Consumer properties


Through testing of our microservices that utilize Spring Cloud Stream, we have verified that the configuration below is not honored by the Spring Cloud Stream Binder for AWS Kinesis when exceptions are encountered during stream processing (i.e., stream processing is not retried at all). When using the same configuration with the Spring Cloud Stream Kafka Binder configured, when exceptions are thrown, the consumer processing is retried.

spring:
  cloud:
    stream:
      bindings:
        bindingName:
          binder: kinesis
          consumer:
            back-off-initial-interval: 1000
            back-off-max-interval: 1000
            back-off-multiplier: 2.0
            max-attempts: 5

Is there a reason why the Spring Cloud Stream Binder for AWS Kinesis does not honor these Spring Cloud Stream Consumer properties? Is the intent for the binder to implement them?


Solution

  • There is no delivery retry feature in the KinesisMessageDrivenChannelAdapter. At the moment when we implemented it we realized that this functionality simply can be achieved with a RequestHandlerRetryAdvice on the consumer endpoint of the output channel for this KinesisMessageDrivenChannelAdapter. The retry functionality in Kafka binder is done in the AbstractRetryingMessageListenerAdapter which is outside of Spring Integration scope and does exactly the same what we can with the mentioned RequestHandlerRetryAdvice or @Retryable on the service activator method.