I am working on an application where the event causes spring data repository to save data;
Entity entity = entityRepository.save((Entity) event.getPayload());
this code can throw various exceptions, like DataIntegrityViolationException which is runtime exception.
My Question is how to
- Handle such an exception and
- generate a Message with Payload caused this error
- with Exception,
- allowing Producer to take an action.