Device Mapper
The Device Mapper is responsible for:
-
Fetching device (client) information for each contact
-
Filtering devices based on optional criteria
-
Selecting the proper content based on the device’s language
-
Assembling the final message for delivery, inbox, or embedded messaging
-
Reporting contacts without devices (or filtered contacts) as "not sent"
Subscription format: sending-<batch|tx>-devicemapper-<dg>-sub
Device Fetch Strategies
The Device Mapper supports three device fetch strategies, controlled by the per-customer
flipper USE_POSTGRES_DEVICE_MAPPER:
| Strategy | Description | Selection |
|---|---|---|
PostgreSQL with DynamoDB Fallback |
Primary fetch from PostgreSQL. For contacts with zero PostgreSQL devices, falls back to DynamoDB.
Fallback can be disabled per-customer via |
When |
DynamoDB (legacy) |
Fetches from DynamoDB via |
When |
PostgreSQL only |
Bulk query from PostgreSQL via |
When fallback is explicitly disabled via |
Output Topics
After assembling messages, the Device Mapper publishes to provider-specific delivery topics:
| Topic Pattern | Example |
|---|---|
|
|
|
|
|
|
|
|
|
|
|
|
Not-sent events are published to the data platform via eventPublisher.publishNotSentEvent.
Dependencies
-
Pub/Sub:
-
Receives personalized messages from device mapper subscriptions
-
Publishes assembled messages to provider-specific delivery topics
-
Reports "not sent" to Data Platform
-
Fatal errors go to
sending-mg-errors
-
-
PostgreSQL: Primary device storage (tenant schemas
tenant_<customerId>) -
DynamoDB: Legacy device storage (being phased out)
-
Kibana: Logging
Error Handling
-
Transient errors: Messages (up to whole batches) are NACKed, causing redelivery at a later time.
-
Fatal errors: Published to
sending-mg-errors.
See Error Handling for the full retry policy.