Subscription

Trait Subscription 

Source
pub trait Subscription {
    type SourceId: Eq;
    type Event;
    type Error;

    // Required methods
    fn resume(
        &self,
    ) -> Pin<Box<dyn Future<Output = Result<Pin<Box<dyn Stream<Item = Result<Persisted<Self::SourceId, Self::Event>, Self::Error>> + Send + '_>>, Self::Error>> + Send + '_>>;
    fn checkpoint(
        &self,
        version: u32,
    ) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + '_>>;
}
Expand description

A Subscription to an EventStream which can be “checkpointed”: keeps a record of the latest message processed by itself using checkpoint, and can resume working from such message by using the resume.

Required Associated Types§

Source

type SourceId: Eq

Type of the Source id, typically an AggregateId.

Source

type Event

Event type stored in the EventStore, typically an Aggregate::Event.

Source

type Error

Possible errors returned when receiving events from the notification channel.

Required Methods§

Source

fn resume( &self, ) -> Pin<Box<dyn Future<Output = Result<Pin<Box<dyn Stream<Item = Result<Persisted<Self::SourceId, Self::Event>, Self::Error>> + Send + '_>>, Self::Error>> + Send + '_>>

Resumes the current state of a Subscription by returning the EventStream, starting from the last event processed by the Subscription.

Source

fn checkpoint( &self, version: u32, ) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + '_>>

Saves the provided version (or sequence number) as the latest version processed.

Implementors§

Source§

impl<Store, Subscriber> Subscription for Transient<Store, Subscriber>
where Store: EventStore + Send + Sync, Subscriber: EventSubscriber<SourceId = <Store as EventStore>::SourceId, Event = <Store as EventStore>::Event> + Send + Sync, <Store as EventStore>::SourceId: Send + Sync, <Store as EventStore>::Event: Send + Sync, <Store as EventStore>::Error: Error + Send + Sync + 'static, <Subscriber as EventSubscriber>::Error: Error + Send + Sync + 'static,