Bird
0
0

Which of the following is the correct way to implement a timeout in a microservice call using pseudocode?

easy📝 Conceptual Q12 of 15
Microservices - Resilience Patterns
Which of the following is the correct way to implement a timeout in a microservice call using pseudocode?
Aresponse = callService().waitForever()
Bresponse = callService().withTimeout(5000ms)
Cresponse = callService().retryIndefinitely()
Dresponse = callService().cacheResponse()
Step-by-Step Solution
Solution:
  1. Step 1: Identify timeout syntax in pseudocode

    The correct way to set a timeout is to specify a maximum wait time, like withTimeout(5000ms).
  2. Step 2: Eliminate incorrect options

    response = callService().waitForever() waits forever, no timeout. response = callService().retryIndefinitely() retries indefinitely, not timeout. response = callService().cacheResponse() caches response, unrelated.
  3. Final Answer:

    response = callService().withTimeout(5000ms) -> Option B
  4. Quick Check:

    Timeout = withTimeout(time) [OK]
Quick Trick: Timeout needs a max wait time method like withTimeout() [OK]
Common Mistakes:
MISTAKES
  • Using infinite wait instead of timeout
  • Confusing retry with timeout
  • Mixing caching with timeout

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Microservices Quizzes