Integration
Outreach là một service gần-leaf. Tích hợp runtime duy nhất của nó là verify JWT với JWKS của Identity; tín hiệu outbound duy nhất là một WebSocket broadcast được BO dashboard tiêu thụ.
1. Service anh em
Direction:→gọi /←được gọi bởi /↔hai chiều.
| Sister | Direction | Surface | Contract | Auth | Failure Mode | Idempotency |
|---|---|---|---|---|---|---|
@nx/identity | → | JWKS endpoint (remote) | VerifierApplication verify ES256 JWT | — (JWKS public) | reject request (401) nếu JWKS unreachable | n/a |
| BO dashboard | ← | Subscribe WebSocket room | payload INQUIRY_SUBMITTED | WS session | client re-fetch qua REST nếu lỡ event | n/a |
Không có lời gọi HTTP tới service BANA khác. Không tiêu thụ hay tạo Kafka topic.
@nx/corelà phụ thuộc code nội bộ duy nhất.
2. Hệ thống bên ngoài
| System | Direction | Surface | Auth | Failure Mode |
|---|---|---|---|---|
| PostgreSQL | → | PostgresCoreDataSource (schema outreach) | DB credentials | request fail khi mất kết nối |
| Redis | → | WebSocket pub/sub fan-out | password (tùy chọn) | WS notify skip nếu emitter chưa ready |
Không có provider email/SMTP nào được nối dù package có tagline "Communications" — gửi newsletter ngoài phạm vi (xem Domain Model).
3. Luồng cross-service quan trọng
3.1 Thông báo yêu cầu real-time tới BO
| Bước | Chi tiết |
|---|---|
| 2 | Notify là fire-and-forget sau khi dòng được commit |
| 3 | Hai room: room list (outreach/inquiries) và room theo từng-inquiry |
| 4 | BO phải đã có một WS session mở subscribe vào room |
4. Tính ổn định Contract
| Surface | Stability | Versioning |
|---|---|---|
HTTP /inquiries/submit, /subscribers/subscribe, /subscribers/unsubscribe | stable | URL /v1/ |
HTTP /subscribers/statistics | beta (shape có thể mở rộng) | URL /v1/ |
WS observation/outreach/inquiry/submitted | beta | theo path; payload chỉ thêm |