My spring boot app has a feign client that POST a payload to external endpoint.
There is requirement to audit all the calls, especially when any errors occurs in calling the endpoint (connection, unauthorized etc), after retry are exhausted. To audit,
- need some information from original payload
- http status
- underlying exception message,
- backup original payload for reference
- endpoint
I tried below approaches (for error handling), but still unable to find a solution that covers all above
- feign Fallbackfactory - it has handle to exception, but unable to effectively capture feign response/original payload
- fallbackMethod with resilence4j - here i get access to original payload and exception, but again unable to capture actual response status (401, 503 etc)
- CustomErrorDecoder - Here able to get access to feign Response, but then have to map response body (any request body/payload). Also have to map exception
Appreciate any suggestion/ advise?