Skip to content

Broker Nodes

Đẩy event/metadata ra hệ thống bên ngoài — tách biệt với luồng video.

NodeGiao thứcUse case
cvedix_mqtt_broker_nodeMQTTIoT, edge → cloud
cvedix_kafka_broker_nodeKafkaData pipeline quy mô lớn
cvedix_sse_broker_nodeServer-Sent EventsDashboard web realtime
cvedix_webhook_broker_nodeHTTP POSTTích hợp backend bất kỳ
cvedix_console_broker_nodestdout (JSON)Debug, phát triển
cvedix_xml_socket_broker_nodeXML/TCPHệ thống legacy
cvedix_ba_socket_broker_nodeTCPEvent BA chuyên dụng
cvedix_embeddings_socket_broker_nodeTCPĐẩy embedding vector
cvedix_ba_event_extraction_nodeTrích + lưu snapshot event

Console (debug)

cpp
#include <cvedix/nodes/broker/cvedix_console_broker_node.h>

auto console = std::make_shared<cvedix_nodes::cvedix_console_broker_node>(
    "console_0",
    cvedix_nodes::cvedix_broke_for::NORMAL,  // NORMAL | BA | FACE
    20,     // in mỗi N frame
    100);   // giới hạn số target in ra
console->attach_to({tracker});

MQTT

cpp
auto mqtt = std::make_shared<cvedix_nodes::cvedix_mqtt_broker_node>(
    "mqtt_0",
    cvedix_nodes::cvedix_broke_for::BA,   // chỉ đẩy event BA
    "tcp://broker.local:1883",
    "cvedix/events");
mqtt->attach_to({ba_node});

Webhook

cpp
auto webhook = std::make_shared<cvedix_nodes::cvedix_webhook_broker_node>(
    "webhook_0",
    cvedix_nodes::cvedix_broke_for::BA,
    "https://api.example.com/events");
webhook->attach_to({ba_node});

Định dạng event

Event BA được serialize thành JSON:

json
{
  "event_type": "CROSSLINE",
  "channel_index": 0,
  "frame_index": 1520,
  "timestamp": "2026-07-16T10:30:00Z",
  "target": {
    "label": "person",
    "track_id": 1971462676,
    "box": [869, 117, 135, 381]
  },
  "rule": { "line_id": "crossline_0", "direction": "in" }
}

Pattern điển hình

                       ┌→ osd → screen        (luồng video)
detector → tracker → ba┤
                       └→ mqtt_broker → cloud (luồng event)

Broker chạy bất đồng bộ — mạng chậm không làm nghẽn luồng video.

Phần mềm độc quyền — CVEDIX