Skip to main content

subscribe_callback

Function subscribe_callback 

Source
pub fn subscribe_callback<C: SubscriptionCallback>(
    registry: Arc<SubscriptionRegistry>,
    source_name: String,
    source_id: u32,
    config: SubscriptionConfig,
    callback: C,
) -> CallbackSubscriptionHandle
Expand description

Creates a callback-based subscription.

Registers a subscription in the registry, then spawns a tokio task that calls callback.on_change() for every event. Panics in the callback are caught and forwarded to callback.on_error().

When the broadcast sender is dropped (e.g., via cancel or registry cleanup), the task calls callback.on_complete() and exits.

§Arguments

  • registry — Subscription registry for lifecycle management.
  • source_name — Name of the source MV or query.
  • source_id — Ring 0 source identifier.
  • config — Subscription configuration.
  • callback — Implementation of SubscriptionCallback.