[][src]Struct pulsar::producer::Producer

pub struct Producer<Exe: Executor> { /* fields omitted */ }

Implementations

impl<Exe: Executor> Producer<Exe>[src]

pub fn builder(pulsar: &Pulsar<Exe>) -> ProducerBuilder<Exe>[src]

pub fn topic(&self) -> &str[src]

pub fn partitions(&self) -> Option<Vec<String>>[src]

pub fn options(&self) -> &ProducerOptions[src]

pub fn create_message(&mut self) -> MessageBuilder<(), Exe>[src]

pub async fn check_connection<'_>(&'_ self) -> Result<(), Error>[src]

pub async fn send<T: SerializeMessage + Sized, '_>(
    &'_ mut self,
    message: T
) -> Result<SendFuture, Error>
[src]

Sends a message

this function returns a SendFuture because the receipt can come long after this function was called, for various reasons:

  • the message was sent successfully but Pulsar did not send the receipt yet
  • the producer is batching messages, so this function must return immediately, and the receipt will come when the batched messages are actually sent

Usage:

let f1 = producer.send("hello").await?;
let f2 = producer.send("world").await?;
let receipt1 = f1.await?;
let receipt2 = f2.await?;

pub async fn send_all<T, I, '_>(
    &'_ mut self,
    messages: I
) -> Result<Vec<SendFuture>, Error> where
    T: SerializeMessage,
    I: IntoIterator<Item = T>, 
[src]

pub async fn send_batch<'_>(&'_ mut self) -> Result<(), Error>[src]

sends the current batch of messages

Auto Trait Implementations

impl<Exe> !RefUnwindSafe for Producer<Exe>

impl<Exe> Send for Producer<Exe>

impl<Exe> Sync for Producer<Exe>

impl<Exe> Unpin for Producer<Exe>

impl<Exe> !UnwindSafe for Producer<Exe>

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