Requirements (clarify): reliably sync orders from on-prem ERP to cloud microservices for fulfillment; support low-latency for new orders, backfill/batch reconciliation, intermittent WAN, end-to-end security, audit trails (PCI/GDPR scope), and scalable throughput (peak sales events).
High-level architecture:
On-prem side: Secure Integration Gateway (SIG) + Local Buffer/CDC agent → Encrypted Message Broker (optionally local) → Outbound VPN/Private Link → Cloud Ingress (API Gateway / Message Ingest) → Cloud Stream Processing + Event Store → Microservices.
Supporting components: Identity provider (SAML/OAuth2), Key Management Service (KMS), Monitoring & Audit Store (immutable).
Secure connectors:
- Use a lightweight CDC connector (Debezium-style) or ERP vendor SDK that reads DB transaction logs or published change tables. Run the connector inside SIG with least privilege.
- Transport over mTLS through corporate firewall using a persistent TLS connection or AWS PrivateLink/ExpressRoute. Mutual TLS + OAuth2 client credentials for auth.
- Encrypt data at rest (local buffer) using local KMS and in transit via TLS1.3. Sanitize PII before leaving network.
Data transfer modes:
- Streaming/CDC for near-real-time order events (creates low latency, event-driven downstream).
- Batch (nightly or hourly) for large reconciliations, inventory snapshots, or heavy historical backfills.
- Hybrid: stream new/changed rows; periodically reconcile via batch jobs to guarantee eventual consistency.
Latency & throughput:
- Target <1s–5s for order creation propagation; provision partitioned event streams (Kafka/Kinesis) to scale throughput. Backpressure: implement producer rate limiting and prioritized queues (high-priority orders).
- Use batching for throughput optimization (coalesce small writes in <100ms windows) while preserving ordering guarantees per order ID.
Local buffering & intermittent connectivity:
- Maintain an on-prem durable queue (embedded Kafka/RabbitMQ or persisted file-backed queue) with configurable retention and disk watermarks.
- Retry policy: exponential backoff, circuit breaker, and jump-to-batch mode when streaming unavailable.
- Provide bounded local processing (store-and-forward) and disk quota alerts. On reconnect, preserve causal order and replay using offsets/checkpoints.
Auditing & compliance:
- Produce immutable audit events for every transaction: source timestamp, change type, checksum, user id, correlation id. Store append-only audit logs locally and in cloud (WORM storage or ledger DB).
- Sign events (HMAC) and retain hashes in tamper-evident store. Implement retention policies, role-based access, and audit trails accessible for compliance reports.
- Regular reconciliation jobs verify counts, checksums, and raise alerts on divergence.
Trade-offs:
- CDC streaming increases complexity but reduces latency; batch is simpler and more bandwidth-friendly for bulk.
- Local broker adds resilience but operational overhead. Choose managed cloud ingestion where possible and keep on-prem footprint minimal.
Operational considerations:
- End-to-end observability (traces, metrics, dead-letter queues), automated failover drills, and clear runbooks.
- Data-mapping layer to normalize ERP payloads into canonical events consumed by microservices.