Subscription

Trait Subscription 

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

    // Required methods
    fn resume(
        &self,
    ) -> BoxFuture<'_, Result<SubscriptionStream<'_, Self>, Self::Error>>;
    fn checkpoint(&self, version: u32) -> BoxFuture<'_, Result<(), Self::Error>>;
}
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, ) -> BoxFuture<'_, Result<SubscriptionStream<'_, Self>, Self::Error>>

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) -> BoxFuture<'_, Result<(), Self::Error>>

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: StdError + Send + Sync + 'static, <Subscriber as EventSubscriber>::Error: StdError + Send + Sync + 'static,