This project implements a communication service using Docker Compose, consisting of three main services: comm-gateway, persist-worker, and sender-worker. Each service is responsible for different aspects of the communication workflow.
svc-comm
├── comm-gateway
│ ├── src
│ │ └── index.js # Entry point for the comm-gateway service
│ ├── package.json # Configuration and dependencies for comm-gateway
│ └── Dockerfile # Dockerfile for building the comm-gateway image
├── persist-worker
│ ├── src
│ │ └── index.js # Entry point for the persist-worker service
│ ├── package.json # Configuration and dependencies for persist-worker
│ └── Dockerfile # Dockerfile for building the persist-worker image
├── sender-worker
│ ├── src
│ │ └── index.js # Entry point for the sender-worker service
│ ├── package.json # Configuration and dependencies for sender-worker
│ └── Dockerfile # Dockerfile for building the sender-worker image
├── docker-compose.yml # Docker Compose configuration for all services
├── ddl_migrations.sql # SQL migration file with DDL commands for postgres service
└── README.md # Project documentation
Clone this repository to your local machine.
cd svc-commCopy .env.example content to a new .env file (modify the values if required).
cp .env.example .envUse Docker Compose to build the images for all services:
docker compose buildStart the services using Docker Compose:
docker compose upThe comm-gateway service exposes an API endpoint at POST /communication. You can send requests to this endpoint to publish messages to Kafka.
- comm-gateway: This service handles incoming API requests and publishes messages to the Kafka topic
communication.raw. - persist-worker: This service consumes messages from the
communication.rawtopic, processes them, and saves the data to a Postgres database. It also produces messages to thecommunication.readytopic after saving. - sender-worker: This service listens to the
communication.readytopic, processes the messages, and sends them via various channel adapters (Email, SMS, Webhook, Slack). It updates the database status and thesent_attimestamp.
- Ensure that Docker and Docker Compose are installed on your machine.
- Modify the environment variables in the
docker-compose.ymlfile as needed for your setup. - Refer to the individual service directories for specific implementation details and dependencies.