Struct nats::jetstream::Consumer[][src]

pub struct Consumer {
    pub nc: NatsClient,
    pub stream: String,
    pub cfg: ConsumerConfig,
    pub push_subscriber: Option<Subscription>,
    pub timeout: Duration,
    pub dedupe_window: RangeTree,
}

JetStream reliable consumption functionality.

Fields

nc: NatsClient

The underlying NATS client

stream: String

The stream that this Consumer is interested in

cfg: ConsumerConfig

The backing configuration for this Consumer

push_subscriber: Option<Subscription>

The backing Subscription used if this is a push-based consumer.

timeout: Duration

The amount of time that is waited before erroring out during process and process_batch. Defaults to 5ms, which is likely to be far too low for workloads crossing physical sites.

dedupe_window: RangeTree

Contains ranges of processed messages that will be filtered out upon future receipt.

Implementations

impl Consumer[src]

pub fn from_consumer_info(ci: ConsumerInfo, nc: NatsClient) -> Result<Consumer>[src]

Instantiate a JetStream Consumer from an existing ConsumerInfo that may have been returned from the nats::Connection::list_consumers iterator.

Requires the jetstream feature.

pub fn create_or_open<S, C>(
    nc: NatsClient,
    stream: S,
    cfg: C
) -> Result<Consumer> where
    S: AsRef<str>,
    ConsumerConfig: From<C>, 
[src]

Instantiate a JetStream Consumer. Performs a check to see if the consumer already exists, and creates it if not. If you want to use an existing Consumer without this check and creation, use the Consumer::existing method.

Requires the jetstream feature.

pub fn existing<S, C>(nc: NatsClient, stream: S, cfg: C) -> Result<Consumer> where
    S: AsRef<str>,
    ConsumerConfig: From<C>, 
[src]

Use an existing JetStream Consumer

Requires the jetstream feature.

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> Same<T> for T

type Output = T

Should always be Self

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