Distribution Groups
Overview
Distribution Groups (DGs) provide workload isolation in the sending chain. Each DG represents an independent sending pipeline with its own set of Pub/Sub topics and subscriptions. This ensures that high-volume or slow customers do not impact the throughput of others.
Active Distribution Groups
There are currently 5 active distribution groups in production:
| DG | ID |
|---|---|
dg00 |
Default (all customers not explicitly routed elsewhere) |
dg01 |
Dedicated customers |
dg02 |
Dedicated customers |
dg03 |
Dedicated customers |
dg04 |
Dedicated customers |
The default DG is dg00 (configurable via DEFAULT_DISTRIBUTION_GROUP).
Customer Routing
Customers are assigned to distribution groups via the distributionGroups configuration,
which maps DG names to arrays of customer IDs. Customers not present in any mapping
are routed to the default group (dg00).
Topic Naming Convention
All Pub/Sub topics follow the pattern: sending-<sourceType>-<component>-<dg>
| Purpose | Pattern | Example |
|---|---|---|
TX entry |
|
|
Batch entry |
|
|
Fetcher |
|
|
Device mapper |
|
|
Personalization |
|
|
Delivery (push) |
|
|
Delivery (web push) |
|
|
Inbox |
|
|
Embedded message |
|
|
Subscriptions follow the pattern: <topic-name>-sub (e.g., sending-tx-dg00-sub)
Deployment
Each DG is deployed as independent Kubernetes replicas. HPA (Horizontal Pod Autoscaler)
configurations are maintained per DG in gap/production/.
CLI Argument
All component main.ts files accept the -d <distributionGroup> argument
(e.g., -d dg01). BullMQ queues are also suffixed with the DG name
(e.g., launches-dg00).
Code Location
-
Topic name builders:
src/lib/distribution-groups/topic-names.ts -
Routing config:
src/lib/distribution-groups/routing-config.ts