ANSCloud — Partner Integration Architecture

3-Tier Integration Strategy: REST API → AMQP Protocol → C++ FFI Library
TIER 1 REST / WebSocket API Gateway ★ Recommended for most partners
🌐
Partner CMS
Any language
Node.js Python Go Java C# PHP Ruby
──────►
HTTPS / WSS
🛡️
API Gateway
Cloud B
Auth + Rate Limit
──────►
AMQP internal
📨
RabbitMQ
Cloud B
Exchanges + Queues
──────►
AMQP TLS
📷
AIBOX
anscloud-device
C++ + Your RabbitMQ API
TIER 2 Native AMQP Protocol (Direct Broker Access) Advanced integrators, on-prem
Partner CMS
Native AMQP lib
amqplib pika amqp091-go Spring AMQP
════════════════════════►
AMQP 0-9-1 (direct, same protocol)
📨
RabbitMQ
Cloud B
Partner vhost
──────►
AMQP TLS
📷
AIBOX
anscloud-device
C++ + Your RabbitMQ API
TIER 3 C++ Gateway Library via FFI Your CMS, embedded, C/C++ partners
🔧
Partner CMS
Links .dll / .so
cgo ctypes P/Invoke ffi-napi JNI
──────►
C API (FFI)
📦
anscloud-gateway
C++ lib (CMSCore)
gateway_agent_c.h
──────►
Your RabbitMQ API
📨
RabbitMQ
Cloud B
──────►
AMQP TLS
📷
AIBOX
anscloud-device
C++ + Your RabbitMQ API

☁️ Cloud B — Messaging Platform (You Own)

API Gateway Layer

REST endpoints for commands, status, telemetry
WebSocket for real-time event streaming
Webhook push to partner URLs
API key auth + JWT per tenant
Rate limiting per partner tier
Serves Tier 1 partners

RabbitMQ Broker

ex.command → direct → device queues
ex.device.telemetry → topic → ingest
ex.device.events → topic → processor
ex.device.status → topic → tracker
ex.broadcast → fanout → all devices
vhost isolation per tenant

AIBOX Devices

anscloud-device (C++ static lib)
Uses YOUR existing RabbitMQ C++ API
IMessageBroker adapter pattern
Auto boot → connect → heartbeat
Publishes telemetry, events, status
Receives & executes commands

Command RPC Flow (Tier 1 Example)

Partner POST /api/v1/devices/AIBOX-001/commands {"command":"get_config"}

API GW generates cmd_id + correlation_idpublish to ex.command routing_key=AIBOX-001

RabbitMQ routesq.cmd.AIBOX-001

AIBOX consumesexecutes locallypublishes responseex.command.response

API GW matches correlation_idresolves pending request

Partner receives HTTP 200 {"status":"success","result":{"version":"3.2.0","cameras":3}}

── Partner sees a simple REST call. RabbitMQ is completely hidden. ──

Tier Comparison

Language Support Setup Effort Latency Partner Needs You Control Best For
Tier 1 — REST API Any Minutes ~50ms added API key + docs Auth, rate limits, versioning SaaS partners, web/mobile
Tier 2 — AMQP Direct Has AMQP lib Hours Lowest Protocol guide + credentials vhost isolation Large integrators, on-prem
Tier 3 — C++ FFI Has FFI support Days Low DLL/so + C headers Full protocol encapsulated Your CMS, embedded, C++ devs