Bird
0
0

Consider this simplified pseudo-code for an Ambassador proxy handling requests:

medium📝 Analysis Q13 of 15
Microservices - Advanced Patterns
Consider this simplified pseudo-code for an Ambassador proxy handling requests:
class AmbassadorProxy {
  sendRequest(request) {
    if (this.isServiceAvailable()) {
      return this.forward(request);
    } else {
      return this.retry(request);
    }
  }
}
What will happen if the main service is temporarily down?
AThe proxy forwards the request without checking availability
BThe proxy retries sending the request until the service is available
CThe proxy immediately returns an error without retrying
DThe proxy stores the request permanently without forwarding
Step-by-Step Solution
Solution:
  1. Step 1: Analyze the sendRequest method logic

    The method checks if the service is available. If yes, it forwards the request; otherwise, it retries.
  2. Step 2: Determine behavior when service is down

    If the service is down, isServiceAvailable() returns false, so retry(request) is called to resend the request.
  3. Final Answer:

    The proxy retries sending the request until the service is available -> Option B
  4. Quick Check:

    Service down triggers retry in Ambassador proxy [OK]
Quick Trick: Ambassador retries requests if service unavailable [OK]
Common Mistakes:
  • Assuming proxy forwards without checking
  • Thinking proxy returns error immediately
  • Believing proxy stores requests permanently

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Microservices Quizzes