Skip to main content

Communication Service — Migration Plan

Status: populated Owner: TBD Last updated: 2026-04-17 Companion: Service Template · ADR-0047

1. Scope

Consolidate legacy messaging service (COM-MSG) + virtual-care service + ad-hoc notification code paths into the unified communication-service.

2. Phases

PhaseScopeMilestone
P0 — Route duality/v1/communication/* added as canonical; /v1/digital-communication/* and /v1/messaging/* remain as aliasesM1
P1 — Event dual publishCanonical ghasi.digital_communication.* published in parallel with legacy ghasi.messaging.* and VIRTUAL_CARE.*M1
P2 — Schema unificationMerge messaging + virtual-care schemas into communication schema; legacy tables read-onlyM2
P3 — Consumer migrationAll downstream services subscribe to canonical subjects; legacy consumers stoppedM3
P4 — Alias sunsetRemove legacy routes + legacy events + legacy tablesM4

3. Data migration

SourceTargetStrategy
messaging.threadscommunication.message_threadsBackfill by tenant_id; preserve IDs; add node_id when null
messaging.messagescommunication.messagesStream copy with ordering by sent_at; verify checksums
messaging.read_receiptscommunication.message_read_receiptsDirect copy
messaging.attachmentscommunication.message_attachmentsCopy metadata; rescan AV if older than 90 days
virtual_care.sessionscommunication.virtual_sessionsCopy; state map to new enum
virtual_care.participantscommunication.virtual_participantsCopy
Notification stubs (various)communication.notification_intentsBuild from historical audit; optional - can forward-only

4. Event migration

Old subjectNew subjectDual-publish
ghasi.messaging.sentghasi.digital_communication.message.sentUntil M3
ghasi.messaging.readghasi.digital_communication.message.readUntil M3
VIRTUAL_CARE.session.createdghasi.digital_communication.virtual_session.createdUntil M3
portal.notification.queued (consumed)unchanged
SCHEDULING.appointment.created (consumed)unchanged

5. Tenant rollout

  1. Shadow period (2 weeks per tenant): both old and new services run; new service publishes dual events but responses come from old paths — used to verify data parity.
  2. Flip: canonical routes become primary; old routes reverse-proxy to new service.
  3. Observation: 30-day monitoring for SLO parity, error-rate parity.
  4. Decommission: legacy service stopped and DB dropped after 60-day retention.

6. Backout plan

  • Kong route swap is reversible in < 5 minutes.
  • Legacy service retained (scaled to zero) through P4; can be scaled back on rollback.
  • Data migration is copy, not move; legacy tables preserved until P4 GA.

7. Risks during migration

RiskMitigation
Duplicate events during dual-publishConsumers keyed off canonical types; legacy aliases deduped by correlation id
Thread ID collisionPreserve IDs; namespace prefix thr_ was already unique
Notification lost between systemsSequence-preserving forward queue; reconcile report
User-visible latency regressionCanary per tenant; rollback on p95 degradation