Skip to main content

ensure_event_client_origin

Function ensure_event_client_origin 

Source
pub fn ensure_event_client_origin(path: PathBuf)
Expand description

Ensure this process can publish/subscribe events, wiring a CLIENT-mode event origin connected to the event service’s UDS plane if needed (#275).

Idempotent and safe to call from any process at startup:

  • If the process-global origin is ALREADY initialized (this process hosts the event service, which calls init_global_moq_event_origin + serve_event_moq_uds_background in its factory), this is a no-op — the in-process origin is authoritative.

  • Otherwise it creates a fresh local origin, registers it as the global, and spawns the background link to the event service’s UDS (connect_event_moq_uds_background). After this returns, EventPublisher::new / EventSubscriber succeed in this process and events flow cross-process to the shared bus.

Must be called from within a tokio runtime (it spawns a background task). path is the event service’s UDS socket (use crate::paths::event_socket).