Aggregate Consumer, Payment, and Address APIs with Partial Failure
Company: DoorDash
Role: Software Engineer
Category: Software Engineering Fundamentals
Difficulty: medium
Interview Round: Technical Screen
Implement a Java bootstrap endpoint that calls consumer, payment, and address upstream APIs and combines their data into one response. Treat any non-2xx upstream status as failure, even when the HTTP client throws no exception. If consumer fails, return HTTP 500. If payment or address fails, preserve the other successful fields in a partial response.
Discuss concurrent calls, timeouts, retry versus omission, and whether first/last name fields exist in the address response according to the supplied schema.
### Constraints & Assumptions
The source does not provide endpoint URLs or payload schemas. Use typed adapters to the given APIs rather than inventing fields. Optional-service failure representation must follow the provided response contract; an illustrative internal result can carry success, data, and error separately.
### Clarifying Questions to Ask
- Can all three calls start independently, or do payment/address need consumer data first?
- What deadline applies to the entire bootstrap request and each upstream call?
- Are these calls idempotent, and which statuses are eligible for retry?
- Does the address schema actually include first and last names?
```hint Optional failure must stay local
One failed optional future should not erase successful results from the other upstreams.
```
### What a Strong Answer Covers
- Status inspection plus transport, timeout, and decoding error handling.
- Required-consumer versus optional-payment/address semantics.
- Concurrent execution with bounded deadlines and structured partial results.
- Contract tests beyond the all-success path.
### Follow-up Questions
- How would you stop waiting for optional services once the overall deadline expires?
- Why can immediate retries amplify an upstream outage?
Overview: Aggregate Java bootstrap APIs with required consumer data, optional payment/address sections, HTTP status checks, bounded concurrency, timeouts, and safe partial responses.
Implement a Java bootstrap endpoint that calls consumer, payment, and address upstream APIs and combines their data into one response. Treat any non-2xx upstream status as failure, even when the HTTP client throws no exception. If consumer fails, return HTTP 500. If payment or address fails, preserve the other successful fields in a partial response.
Discuss concurrent calls, timeouts, retry versus omission, and whether first/last name fields exist in the address response according to the supplied schema.
Constraints & Assumptions
The source does not provide endpoint URLs or payload schemas. Use typed adapters to the given APIs rather than inventing fields. Optional-service failure representation must follow the provided response contract; an illustrative internal result can carry success, data, and error separately.
Clarifying Questions to Ask Guidance
Can all three calls start independently, or do payment/address need consumer data first?
What deadline applies to the entire bootstrap request and each upstream call?
Are these calls idempotent, and which statuses are eligible for retry?
Does the address schema actually include first and last names?
What a Strong Answer Covers Guidance
Status inspection plus transport, timeout, and decoding error handling.
Required-consumer versus optional-payment/address semantics.
Concurrent execution with bounded deadlines and structured partial results.
Contract tests beyond the all-success path.
Follow-up Questions Guidance
How would you stop waiting for optional services once the overall deadline expires?
Why can immediate retries amplify an upstream outage?