Skip to content

eventually-core: add Subscriber trait support #88

@ar3s3ru

Description

@ar3s3ru

A Subscriber should allow to create subscriptions to new changes happening in the EventStore.

Changes received from the Subscriber should start from when the subscription has started, onwards.

The base idea of a Subscriber is very similar to the EventStore, looking like this:

pub trait Subscriber {
    type SourceId: Eq;
    type Event;
    type Error;

    fn subscribe_all(&self) -> BoxFuture<Result<EventStream<Self>, Self::Error>>;

    // We can provide a default implementation using `subscribe_all`
    fn subscribe(&self, id: Self::SourceId) -> BoxFuture<EventStream<Self>, Self::Error>;
}

The Subscriber can then be used to attach Publishers to relay the events onto message brokers (e.g. Kafka, RabbitMQ), or to run Projectors.

Metadata

Metadata

Assignees

No one assigned

    Labels

    eventually-coreIssue or Pull Request involves eventually-core cratefeatureNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions