Skip to content

Integration

1. Service anh em

Direction: gọi / được gọi / hai chiều.

Anh emHướngBề mặtHợp đồngAuthFailure Mode
@nx/identityHTTP JWKS (/jw-certs)JWKSVerifierTokenServicetoken bị từ chối nếu fetch JWKS thất bại
@nx/sale / @nx/paymentKafka signal.activity-notificationTActivityNotificationMessageat-least-once; không retry khi handler lỗi
@nx/sale / @nx/paymentRedis pub/sub (WebSocketEmitter){ topic, data, destination }best-effort; bỏ nếu không instance nào subscribe
@nx/corerepository in-processActivityNotificationRepository, PolicyDefinitionRepositorylỗi DB lan truyền, message không commit

Producer (@nx/sale, @nx/payment) không host một WebSocket server. Họ publish qua một WebSocketEmitter nhẹ; Signal là service duy nhất sở hữu một WebSocketServerHelper và subscribe bus.

2. Hệ thống ngoài

Hệ thốngHướngBề mặtAuthFailure Mode
WebSocket client (POS / Admin / Tauri)WSS /stream (ECDH + AES-256-GCM)JWT trong handshaketừ chối nếu thiếu JWT hợp lệ + clientPublicKey
Redispub/sub (single hoặc cluster)password (tuỳ chọn)offline queue (cluster) / retry (single)
Kafkaconsumer (SASL tuỳ chọn)SCRAM/PLAINbroker reconnect; thiếu brokers → fail-fast lúc boot

3. Luồng xuyên service quan trọng

3.1 Thanh toán thành công → notification cho user

BướcChi tiết
1Producer chọn recipientScope; org/merchant giải phía server qua PolicyDefinitionRepository, users dùng recipientIds
4Cùng hàng cũng lấy được qua GET /notifications; WS push là gợi ý live, không phải nguồn sự thật

3.2 Push trực tiếp xuyên instance / xuyên service

4. Độ ổn định hợp đồng

Bề mặtĐộ ổn địnhVersioning
WS /stream handshake (type, token, clientPublicKey)ổn địnhkhông — một protocol
Payload Kafka signal.activity-notificationbetahình dạng TActivityNotificationMessage; chưa trường version
WS topic observation/signal/notification/createdbetatheo path
REST /notifications, /socket/websocket/clientsổn địnhURL /v1/

5. Trang liên quan

Proprietary and Confidential. Unauthorized copying, distribution, or use of this software is strictly prohibited.