[−][src]Struct nakadion::consumer::Consumer
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]
prefix: T
) -> Result<Builder, Error>
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 a
ConsumerHandlewill be returned. The
Consumingwill complete with a
ConsumptionOutcomeonce 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
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]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T> Instrument for T
[src]
pub fn instrument(self, span: Span) -> Instrumented<Self>
[src]
pub fn in_current_span(self) -> Instrumented<Self>
[src]
impl<T> Instrument for T
[src]
pub fn instrument(self, span: Span) -> Instrumented<Self>
[src]
pub fn in_current_span(self) -> Instrumented<Self>
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,