Skip to main content

routing-engine — Event Schemas

Status: populated | Last updated: 2026-04-18

routing-engine consumes one NATS event and publishes none.

1. Consumed Events

1.1 OperatorHealthEvent

NATS Subject: operator.health Published by: operator-management-service (via smpp-connector relay) Consumer group: routing-engine-health

/**
* Published when an SMPP operator's connection state changes.
* routing-engine uses this to update the Redis health cache.
*/
interface OperatorHealthEvent {
/** Event schema version */
version: '1.0';

/** Unique event identifier (UUID v4) */
eventId: string;

/** ISO 8601 timestamp when the event was emitted */
occurredAt: string;

/** Internal UUID of the operator */
operatorId: string;

/** Human-readable operator name for logging */
operatorName: string;

/** New health state of the operator */
status: OperatorHealthStatus;

/** Previous health state, for transition logic */
previousStatus: OperatorHealthStatus | null;

/** Optional reason string (e.g. "enquire_link timeout") */
reason?: string;
}

type OperatorHealthStatus = 'BOUND' | 'UNBOUND' | 'FAILBACK';

Example payload:

{
"version": "1.0",
"eventId": "a3f12c88-0001-4e2b-8d9a-1234abcd5678",
"occurredAt": "2026-04-18T10:30:00.000Z",
"operatorId": "550e8400-e29b-41d4-a716-446655440001",
"operatorName": "Roshan-AF",
"status": "UNBOUND",
"previousStatus": "BOUND",
"reason": "TCP connection reset by peer"
}

Processing contract:

  • On UNBOUND: update Redis operator:health:{operatorId} to UNBOUND; initiate cache key invalidation sweep for affected routing decisions.
  • On BOUND or FAILBACK: update Redis operator:health:{operatorId} accordingly.
  • Acknowledge the NATS message after Redis write completes.
  • On Redis write failure: NAK the message (NATS will redeliver).

2. Published Events

None. routing-engine is a pure gRPC responder + NATS consumer. It does not emit any events to NATS.