When a Kinesis stream consumer encounters an error and an exception is thrown in a method annotated with @StreamListener
, how can the binding be configured so that the message is re-queued or sent to a DLQ? I see this level of support for Rabbit and Kafka in Spring Cloud Stream, but I'm not seeing it for the Kinesis binding. What is the recommended approach for handling errors in a Kinesis stream processor? How is it done via configuration and/or code?
1
votes
1 Answers
2
votes
The AWS Kinesis Binder implementation is fully based on the Spring Cloud Stream Core and just re-uses its generic approach for error handling: https://cloud.spring.io/spring-cloud-static/spring-cloud-stream/2.2.0.RELEASE/spring-cloud-stream.html#spring-cloud-stream-overview-error-handling
So, what you need is just some @ServiceActivator
for particular destination error channel and do whatever you need with a failed record.
There is no DLQ/DLX/DLT functionality in AWS Kinesis at all, so I don't see reason to abuse it purpose and introduce something artificial into Kinesis Binder.