Function register_subscriber
Function register_subscriber
Generated from cargo doc --no-deps -p nemo-relay-builtins -p nemo-relay-diagnostics -p nemo-relay-logging -p nemo-relay-plugin-host -p nemo-relay-codecs -p nemo-relay -p nemo-relay-runtime -p nemo-relay-model-pricing -p nemo-relay-resource-metrics -p nemo-relay-observability -p nemo-relay-adaptive -p nemo-relay-pii-redaction -p nemo-relay-ffi -p nemo-relay-types -p nemo-relay-plugin -p nemo-relay-worker-proto -p nemo-relay-worker.
pub fn register_subscriber(
name: &str,
callback: Arc<dyn Fn(&Event) + Sync + Send>,
) -> Result<(), FlowError>
Register a global lifecycle event subscriber.
The subscriber is added to the process-wide registry and receives every emitted scope, tool, LLM, and mark event until it is deregistered.
Parameters
name: Unique subscriber name in the global registry.callback: Subscriber callback invoked for each emitted event.
Returns
A Result that is Ok(()) when the subscriber was registered.
Errors
Returns FlowError::AlreadyExists when another global subscriber is already registered under the same name.
Notes
Global subscribers remain active across scopes until explicitly removed. Native event-producing APIs enqueue subscriber work and return without waiting for callbacks. During tool scope start/end delivery, derived marks inherit the observed tool scope as their parent, including after the tool closes. An explicit mark parent takes precedence over this callback context.