Correspondence Service

NestJS:8008Core

The Correspondence Service handles the complete lifecycle of correspondence including creation, routing, tracking, and archival. It supports both HTTP API and RabbitMQ worker mode.

Key Features

  • Correspondence Lifecycle — Create, route, track, and archive correspondence
  • Access Control — Permission-based correspondence access
  • Task Integration — Automatic task creation for correspondence actions
  • Failed Delivery Tracking — Monitor and retry failed deliveries
  • Fuzzy Search — Levenshtein distance matching for search
  • Dual Mode — HTTP server + RabbitMQ worker

API Endpoints

GET
/api/correspondence

List correspondence with pagination and filters

POST
/api/correspondence

Create new correspondence

GET
/api/correspondence/:id

Get correspondence details

PUT
/api/correspondence/:id

Update correspondence

POST
/api/correspondence/:id/route

Route correspondence to recipients

GET
/api/correspondence/:id/history

Get correspondence routing history

POST
/api/correspondence/:id/archive

Archive correspondence

Configuration

NameTypeDefaultDescription
PORTnumber8008Service listening port
DB_HOSTstringlocalhostMSSQL server host
DB_USERNAMEstring-Database username
DB_PASSWORDstring-Database password
RABBITMQ_URISstring-RabbitMQ connection URIs
REDIS_HOSTstringlocalhostRedis host

RabbitMQ Integration

Publishes to:

  • Notification events for routing and status changes
  • Search indexing events

Consumes from:

  • Correspondence-related events from other services

Dependencies

  • Media Service — File attachments
  • CMS Service — Task updates and content management
  • Identity Service — User authentication and authorization