Skip to main content

Module subscription

Module subscription 

Source
Expand description

Streaming Subscription API.

A Subscription provides access to records from a Sink. It supports:

  • Non-blocking poll
  • Blocking receive with optional timeout
  • Iterator interface
  • Zero-allocation batch operations

§Usage

let subscription = sink.subscribe();

// Non-blocking poll
while let Some(batch) = subscription.poll() {
    process(batch);
}

// Blocking receive
let batch = subscription.recv()?;

// With timeout
let batch = subscription.recv_timeout(Duration::from_secs(1))?;

// As iterator
for batch in subscription {
    process(batch);
}

Structs§

Subscription
A subscription to a streaming sink.

Enums§

SubscriptionMessage
Message types that can be received from a subscription.