pub struct SubscriptionConfig {
pub id: Uuid,
pub stream_name: SubscriptionName,
pub frequency: Duration,
}
Expand description
A configuration for a subscription to a stream of events.
Fields§
§id: Uuid
A unique identifier for the subscription. See SubscriptionConfig::stream_id
for
a fully qualified identifier.
stream_name: SubscriptionName
The name of the stream that the subscription is listening to. This is the target stream that the subscription is reading from, and is combined with the id to form the fully qualified stream id.
frequency: Duration
The frequency at which the subscription should poll the target stream for new events. Used for throttling the stream, so that it doesn’t consume too many resources or hammer any external services.
Implementations§
Source§impl SubscriptionConfig
impl SubscriptionConfig
Sourcepub fn new(id: Uuid, stream_name: SubscriptionName, frequency: Duration) -> Self
pub fn new(id: Uuid, stream_name: SubscriptionName, frequency: Duration) -> Self
Create a new subscription configuration.
Sourcepub fn subscription<Repo>(
&self,
repo: &Repo,
) -> Result<Subscription<Repo>, String>
pub fn subscription<Repo>( &self, repo: &Repo, ) -> Result<Subscription<Repo>, String>
Resumes a subscription with the given id.
Sourcepub fn stream<Repo>(&self, repo: &Repo) -> impl Stream<Item = Frame>
pub fn stream<Repo>(&self, repo: &Repo) -> impl Stream<Item = Frame>
Construct a throttled stream of frames from the subscription.
Sourcepub fn worker(&self, worker: SubscriptionWorker) -> impl Stream<Item = Frame>
pub fn worker(&self, worker: SubscriptionWorker) -> impl Stream<Item = Frame>
Start a worker stream with the given service.
Trait Implementations§
Source§impl Clone for SubscriptionConfig
impl Clone for SubscriptionConfig
Source§fn clone(&self) -> SubscriptionConfig
fn clone(&self) -> SubscriptionConfig
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreAuto Trait Implementations§
impl Freeze for SubscriptionConfig
impl RefUnwindSafe for SubscriptionConfig
impl Send for SubscriptionConfig
impl Sync for SubscriptionConfig
impl Unpin for SubscriptionConfig
impl UnwindSafe for SubscriptionConfig
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more