[][src]Struct tokio_nsq::NSQProducer

pub struct NSQProducer { /* fields omitted */ }

An NSQD producer corresponding to a single instance.

Before any messages are published you must wait for an NSQEvent::Healthy() message. If any messages are queued while the connection is unhealthy the publish method shall return an error and the message will not be queued. Messages are queued and delivered asynchronously. Once NSQ acknowledges a message an NSQEvent::Ok() will be available from consume.

Multiple messages can be queued before any are acknowledged. You do not need to wait on consume immediately after each publish. If any NSQEvent::Unhealthy() event is ever returned, all unacknowledged messages up to that point are now considered failed, and must be requeued. A producer will not buffer messages waiting for a healthy connection.

Implementations

impl NSQProducer[src]

pub async fn consume<'_>(&'_ mut self) -> Option<NSQEvent>[src]

Consume message acknowledgements, and connection status updates.

pub fn publish(
    &mut self,
    topic: &Arc<NSQTopic>,
    value: Vec<u8>
) -> Result<(), Error>
[src]

Queue a PUB message to be asynchronously sent

pub fn publish_deferred(
    &mut self,
    topic: &Arc<NSQTopic>,
    value: Vec<u8>,
    delay_milliseconds: u32
) -> Result<(), Error>
[src]

Queue a DPUB message to be asynchronously sent

pub fn publish_multiple(
    &mut self,
    topic: &Arc<NSQTopic>,
    value: Vec<Vec<u8>>
) -> Result<(), Error>
[src]

Queue an MPUB message to be asynchronously sent

Auto Trait Implementations

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