I have followed the below documentation and I have a producer and Consumer working perfectly fine with Kinesis Stream. I would like to understand how to handle the ERROR in Producer (Source) and Consumer (Processor) in case of any exception happens.
I have tried below approaches as per Spring Stream Error Handling Documentations:
I have tried using @ServiceActivator("input-stream.input-stream-group.erros") - this works, but my "input-stream" is a dynamic name in each production environment as per the policy I should append a production environment name while defining the Data Stream. This is preferred way but How to solve this?
I have tried using @ServiceActivator("errorChannel") - this is not working means the ERROR is catching and printing if I introduce a method for this and put a Logger but ERROR is throwing due to below rethrow in
org.springframework.cloud.stream.binding.StreamListenerMessageHandler
(line 53-68)catch (Exception e) { if (e instanceof MessagingException) { throw (MessagingException) e; } else { throw new MessagingException(requestMessage, "Exception thrown while invoking " + this.invocableHandlerMethod.getShortLogMessage(), e); } }
I have Autowired a MessageChannel in the same name of "errorChannel" and while Catching the Exception I have prepared a Message and send to it, but same as above in the ServiceActivator method behaves.
How do I can handle and solve this? Please suggest and help me.