MCPcopy Create free account
hub / github.com/NodeDB-Lab/nodedb / notify_topic

Function notify_topic

nodedb/src/event/alert/notify.rs:68–96  ·  view source on GitHub ↗

Publish alert event to a CDC topic.

(state: &SharedState, tenant_id: u64, topic_name: &str, event: &AlertEvent)

Source from the content-addressed store, hash-verified

66
67/// Publish alert event to a CDC topic.
68fn notify_topic(state: &SharedState, tenant_id: u64, topic_name: &str, event: &AlertEvent) {
69 let payload = match sonic_rs::to_string(event) {
70 Ok(p) => p,
71 Err(e) => {
72 warn!(alert = event.alert_name, error = %e, "failed to serialize alert event");
73 return;
74 }
75 };
76
77 match crate::event::topic::publish::publish_to_topic(state, tenant_id, topic_name, &payload) {
78 Ok(seq) => {
79 info!(
80 alert = event.alert_name,
81 topic = topic_name,
82 seq,
83 status = event.status,
84 "alert event published to topic"
85 );
86 }
87 Err(e) => {
88 warn!(
89 alert = event.alert_name,
90 topic = topic_name,
91 error = %e,
92 "failed to publish alert event to topic"
93 );
94 }
95 }
96}
97
98/// HTTP POST alert event to a webhook URL using a shared `reqwest::Client`.
99///

Callers 1

dispatch_notificationsFunction · 0.85

Calls 1

publish_to_topicFunction · 0.85

Tested by

no test coverage detected