Cosmos DB Change Feed Trigger
The CameraOrchestratorFunction is the main entry point for the Image Acquisition Engine. It monitors the acquisitionDevice container in Cosmos DB and reacts to device configuration changes in real-time.
How It Worksโ
Trigger Configurationโ
The function is decorated with [CosmosDBTrigger]:
- Database: Image acquisition database
- Container:
acquisitionDevice - Lease Container: Auto-created for change feed checkpointing
- Connection: Loaded from Azure App Configuration
In release builds (#if !DEBUG), the Cosmos trigger is active. In debug builds, an HTTP endpoint (HttpStart) is available for manual testing.
Routing Logicโ
When a change is detected, the orchestrator routes by camera manufacturer:
| Manufacturer | Orchestrator | Status |
|---|---|---|
| Axis | VapixOrchestrator | Active โ full implementation |
| Mobotix | MobotixOrchestrator | Skeleton โ awaiting hardware integration |
Batch Processingโ
When the change feed delivers multiple device changes in a single batch (e.g., bulk deploy from Admin API):
- Each device is enqueued to the
orchestration-redeployqueue - The
SingleImageMetadataCleanupDequeuequeue trigger processes them in parallel - This prevents the Cosmos trigger from being blocked by long-running orchestration setup
Decision Flowโ
For each device change, the orchestrator decides:
- Deploy โ No existing orchestration +
isActive = trueโ start new - Redeploy โ Existing orchestration +
isActive = trueโ terminate old, start new with latest config - Stop โ
isActive = falseโ terminate running orchestration