pub struct SubscriptionHandle { /* private fields */ }Expand description
Handle returned by channel subscriptions for receiving validated envelopes.
Owns the subscriber’s beamr pid, the shared inbox, and a clone of the scheduler so the process can be terminated when the subscription ends. The handle is the subscription’s lifetime: dropping the last clone terminates the subscriber process, whose EXIT prunes the channel actor’s fan-out list.
Implementations§
Source§impl SubscriptionHandle
impl SubscriptionHandle
Sourcepub fn try_next(&self) -> Result<Option<Envelope>, LiminalError>
pub fn try_next(&self) -> Result<Option<Envelope>, LiminalError>
Attempts to receive the next delivered envelope without blocking.
§Errors
Returns LiminalError::SubscriptionFailed when the subscription inbox cannot be read.
Sourcepub fn try_next_positioned(
&self,
) -> Result<Option<(Envelope, Option<u64>)>, LiminalError>
pub fn try_next_positioned( &self, ) -> Result<Option<(Envelope, Option<u64>)>, LiminalError>
Receives one envelope with its store position, retaining it until acknowledged.
§Errors
A cursor still awaits its previous acknowledgement, or the inbox/store failed.
Sourcepub fn acknowledge_position(&self, position: u64) -> Result<(), LiminalError>
pub fn acknowledge_position(&self, position: u64) -> Result<(), LiminalError>
Persists the next position only after the consumer has settled this delivery.
§Errors
The position was not delivered, or checkpoint/flush failed.
Sourcepub fn consumer_position(&self) -> Result<Option<u64>, LiminalError>
pub fn consumer_position(&self) -> Result<Option<u64>, LiminalError>
The persisted consumer position, absent on an ordinary live subscription.
§Errors
The consumer lock failed.
Sourcepub fn subscriber_pid(&self) -> u64
pub fn subscriber_pid(&self) -> u64
The subscriber process’s pid: the id
ChannelHandle::publish_recording
records for this subscription, and the one a
ClusterObserver hears it by.
Sourcepub fn has_pending(&self) -> bool
pub fn has_pending(&self) -> bool
Whether an envelope is available without consuming it.
Sourcepub fn is_overflowed(&self) -> bool
pub fn is_overflowed(&self) -> bool
Whether an overflow has marked this subscription for shedding (§5).