[][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 can be cloned so that that multiple connections to Nakadi can be established. But be aware that in this case the consumers will share their resources, e.g. the API client, metrics and logger.

Methods

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

Trait Implementations

impl Clone for Consumer[src]

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> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

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