[][src]Struct nakadion::consumer::Consumer

pub struct Consumer { /* fields omitted */ }

Consumes an event stream

A consumer can be started to to consume a stream of events. To start it will consume itself and be returned once streaming has stopped so that it can be started again.

A consumer can be stopped internally and externally.

The consumer will only return if stopped via a ConsumerHandle or if an error occurs internally. Note that stopping the Consumer from within a handler is also considered an error case as is failing to connect to for a stream. In the error case of not being able to connect to a stream the behaviour can be configured via the ConnectConfig (e.g. it can be configured to retry indefinitely)

Implementations

impl Consumer[src]

pub fn builder() -> Builder[src]

Get an uninitialized Builder.

pub fn builder_from_env() -> Result<Builder, Error>[src]

Create a Builder initialized with values from the environment whereas the environment variables will be prefixed with NAKADION_.

pub fn builder_from_env_prefixed<T: AsRef<str>>(
    prefix: T
) -> Result<Builder, Error>
[src]

Create a Builder initialized with values from the environment whereas the environment variables will be prefixed with <prefix>_.

pub fn builder_from_env_type_names() -> Result<Builder, Error>[src]

Create a Builder initialized with values from the environment whereas the environment variables will not be prefixed at all.

pub fn start(self) -> (ConsumerHandle, Consuming)[src]

Start consuming events.

A 'Consumingand aConsumerHandlewill be returned. TheConsumingwill complete with aConsumptionOutcomeonce consumption has stopped.Consuming` can be dropped if there is no interest in waiting the consumer to finish.

The ConsumerHandle can be used to check whether the Consumer is still running and to stop it.

pub fn add_lifecycle_listener<T: LifecycleListener>(&self, listener: T)[src]

Trait Implementations

impl Debug for Consumer[src]

Auto Trait Implementations

impl !RefUnwindSafe for Consumer

impl Send for Consumer

impl Sync for Consumer

impl Unpin for Consumer

impl !UnwindSafe for Consumer

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,