File size: 1,156 Bytes
5c6c173
 
 
 
 
 
 
 
 
6391dfd
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
ad3a49f
6391dfd
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
---
title: Cuatrolabs Sync Worker Ms
emoji: 🐢
colorFrom: blue
colorTo: green
sdk: docker
pinned: false
---

# SCM Sync Worker Microservice

Dedicated worker service for processing MongoDB → PostgreSQL sync operations.

## Architecture

```
SCM-MS → Redis Queue → Sync-Worker-MS → PostgreSQL
```

## Features

- Processes sync operations from Redis queues
- Independent scaling from SCM API
- Persistent queue (survives restarts)
- Retry logic with exponential backoff
- Monitoring and metrics

## Queues Processed

- `sync:queue:catalogues` (5 workers)
- `sync:queue:employee` (3 workers)
- `sync:queue:merchants` (5 workers)
- `sync:queue:warehouses` (3 workers)
- `sync:queue:uom` (2 workers)

## Deployment

```bash
# Build
docker build -t ghcr.io/mkkbms/sync-worker-ms:latest .

# Deploy
kubectl apply -f deployment.yaml
```

## Environment Variables

- `MONGODB_URI` - MongoDB connection string
- `MONGODB_DB_NAME` - MongoDB database name
- `POSTGRES_*` - PostgreSQL connection details
- `REDIS_*` - Redis connection details

## Scaling

Scale workers independently:
```bash
kubectl scale deployment/sync-worker-ms --replicas=5 -n apps
```