Design a News Subscription Processing Engine
Company: Optiver
Role: Software Engineer
Category: Software Engineering Fundamentals
Difficulty: hard
Interview Round: Take-home Project
Design a news subscription processing engine with four core capabilities: receive a news item, add a subscription, remove a subscription, and publish matching news to subscribers. Focus on the domain model, APIs, indexing, and correctness under concurrent updates.
### Constraints & Assumptions
- A news item has a stable ID and attributes used for matching.
- A subscriber may have several subscriptions.
- The exact subscription predicate language is not prescribed; begin with a small, explicit model and explain how it could evolve.
- Duplicate receipt or publish requests are possible.
- Delivery may fail independently for each subscriber.
### Clarifying Questions to Ask
- Does receipt automatically trigger publication, or are they separate operations?
- What fields may a subscription filter on?
- Should removal affect a news item already being published?
- What delivery guarantee is required?
- Must subscribers observe news in a total order?
### What a Strong Answer Covers
```premium-lock What a Strong Answer Covers
```
### Follow-up Questions
- Add compound subscription predicates.
- Preserve per-subscriber ordering across workers.
- Recover when publication stops halfway through a large fan-out.
Quick Answer: Design a news subscription engine that receives items, manages subscriptions, and publishes each item to matching subscribers. Clarify predicate and delivery semantics while addressing duplicate requests, concurrent removal, subscriber ordering, retries, partial fan-out recovery, backpressure, isolation, and operational visibility.