[][src]Trait eventually::Subscription

pub trait Subscription {
    type SourceId: Eq;
    type Event;
    type Error;
    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>>; }

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.

Associated Types

type SourceId: Eq

Type of the Source id, typically an AggregateId.

type Event

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

type Error

Possible errors returned when receiving events from the notification channel.

Loading content...

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>>

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

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.

Loading content...

Implementors

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,
    <Store as EventStore>::SourceId: Sync,
    <Store as EventStore>::Event: Send,
    <Store as EventStore>::Event: Sync,
    <Store as EventStore>::Error: Error,
    <Store as EventStore>::Error: Send,
    <Store as EventStore>::Error: Sync,
    <Store as EventStore>::Error: 'static,
    <Subscriber as EventSubscriber>::Error: Error,
    <Subscriber as EventSubscriber>::Error: Send,
    <Subscriber as EventSubscriber>::Error: Sync,
    <Subscriber as EventSubscriber>::Error: 'static, 
[src]

type SourceId = <Store as EventStore>::SourceId

type Event = <Store as EventStore>::Event

type Error = Error

Loading content...