0

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

  1. feign Fallbackfactory - it has handle to exception, but unable to effectively capture feign response/original payload
  2. fallbackMethod with resilence4j - here i get access to original payload and exception, but again unable to capture actual response status (401, 503 etc)
  3. 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?

Arpit S
  • 137
  • 2
  • 10

0 Answers0