One solutions could be:
- Anticorruption Layer returns 504.
- Microservice B retries 3 times, and after that returns 500 instead of 504.
- Don't retry on 500 in Microservice A or BFF.
- Every service should have Retry policy and Circuit breaker.
Another solutions could be:
- Anticorruption Layer returns 504.
- Microservice B retries 3 times, and after that sends 504 back with some header (Retry-Count:3)
- In parent service don't retry if Retry-Count is more then 3.
Does it make sense?