Skip to main content

DLR Processor — Service Overview

Status: populated Owner: Platform Engineering Last updated: 2026-04-18 Companion: DOMAIN_MODEL · API_CONTRACTS · EVENT_SCHEMAS

1. Purpose

The DLR Processor is the authoritative handler for inbound delivery receipts (DLRs) within the Ghasi SMS Gateway. It consumes raw DLR events published by operator connectors (primarily smpp-connector), normalises carrier-specific status codes into canonical DlrStatus values, correlates each receipt back to the originating SmsMessage, updates persistent state, and fans the outcome out to downstream consumers (billing pipeline, webhook dispatcher).

The service is event-driven only — it exposes no customer-facing HTTP API, only infrastructure probes.

2. Responsibilities

ResponsibilityDescription
DLR consumptionDurable NATS JetStream consumer on sms.dlr.inbound
Status normalisationMaps SMPP stat values → canonical DlrStatus
Message correlationResolves operatorMessageId → internal messageId + accountId
PersistenceWrites to dlr.delivery_receipts; idempotent on operatorMessageId
Orchestrator state syncUpdates orch.sms_messages.status and dlr_status columns
Orphan handlingUnknown operatorMessageIddlr.orphaned_receipts; publishes sms.dlr.unmatched
Billing triggerPublishes billing.events for each terminal DLR
Webhook triggerPublishes webhook.dispatch for each correlated receipt
ObservabilityExposes Prometheus /metrics; structured JSON logs; OTLP traces

3. Position in the Platform

smpp-connector ──► sms.dlr.inbound ──► dlr-processor ──► orch.sms_messages (PG)
│ dlr.delivery_receipts (PG)
├──► billing.events ──► billing-service
├──► webhook.dispatch ──► webhook-dispatcher
└──► sms.dlr.unmatched ──► reconciliation-job

4. Technology Stack

ConcernTechnology
RuntimeNode.js 20 LTS
FrameworkNestJS 10
LanguageTypeScript 5
Message brokerNATS JetStream
DatabasePostgreSQL 15 (schemas: dlr, orch read/write)
MigrationsFlyway
ContainerisationDocker / Kubernetes
ObservabilityPino (logs), OpenTelemetry (traces), Prometheus (metrics)

5. Non-Goals

  • Does not accept inbound HTTP traffic from external callers.
  • Does not own operator SMPP sessions (delegated to smpp-connector).
  • Does not compute billing charges (delegated to billing-service).
  • Does not deliver webhooks (delegated to webhook-dispatcher).

6. SLOs

MetricTarget
DLR processing latency (p99)< 500 ms end-to-end
DLR processing latency (p50)< 100 ms
Correlation success rate≥ 99.5%
Orphan rate< 0.5% of inbound DLRs
Error rate< 0.1% unhandled failures