Content-based pub-sub broker

DesignHard45 min

Your task

Design a content-based / topic pub-sub broker that supports hierarchical topics and wildcard subscriptions (e.g. sensors/+/temperature, orders/us/#) plus attribute filters (price > 100 AND region = 'eu'). Scale: 5M active subscriptions, 1M messages/sec, and a single message may match thousands of subscriptions. Matching must be fast enough not to bottleneck publish throughput, and subscriptions change frequently.

It covers

  • Topic matching
  • Wildcard subscriptions
  • Filtering