1p3a Question · Oct 2025

SuperMoney Onsite Interview for Machine Coding In-Memory Message Broker

SWE Onsite

Question Details

Problem Statement Design and implement an in-memory message broker library that facilitates asynchronous communication via topics, supporting high concurrency, configurable data retention, and pre

Full Details

Problem Statement Design and implement an in-memory message broker library that facilitates asynchronous communication via topics, supporting high concurrency, configurable data retention, and precise consumer tracking.

System Requirements and Capabilities *

Core Architecture *

Entities: The library manages Topics, Publishers, and Consumers. *

Data Format: Messages are transmitted as strings. *

Relationships: A single topic supports multiple publishers and multiple consumers. While the system supports many-to-many relationships, individual publisher and consumer instances are bound to a specific topic. *

Topic Management: APIs must exist to create and delete topics dynamically. *

Publishing and Concurrency *

Parallel Execution: The library supports parallel publishing, enabling multiple publishers to send messages to a topic simultaneously without blocking one another. *

Consumption and Offset Management *

Execution Model: Consumers process messages as they are received by the topic. *

Independent Tracking: Each consumer manages its own offset independently to track reading progress. *

Error Handling: The system must handle exceptions gracefully to prevent crashes during message processing. *

Data Lifecycle *

Retention Policy: Topics possess a configurable maximum retention period. *

Expiration: Messages exceeding the retention period must be permanently deleted and rendered inaccessible to any consumer. *

Advanced Features *

Message Replay: The system allows resetting a consumer's offset to a specific point to enable message replaying. *

Observability: The library provides visibility into consumer status by calculating and exposing the current offset and message lag.

About This Question

This is a reported interview question from a supermoney interview for a swe role during the onsite round reported in 2025.

It covers the following topics: Os, Concurrency, Strings .