Struct pulsar::producer::MultiTopicProducer
source · pub struct MultiTopicProducer<Exe: Executor> { /* private fields */ }
Expand description
Wrapper structure that manges multiple producers at once, creating them as needed
use pulsar::{Pulsar, TokioExecutor};
let pulsar: Pulsar<_> = Pulsar::builder(addr, TokioExecutor).build().await?;
let mut producer = pulsar.producer().with_name("name").build_multi_topic();
let send_1 = producer.send(topic, &message).await?;
let send_2 = producer.send(topic, &message).await?;
send_1.await?;
send_2.await?;
Implementations§
source§impl<Exe: Executor> MultiTopicProducer<Exe>
impl<Exe: Executor> MultiTopicProducer<Exe>
sourcepub fn options(&self) -> &ProducerOptions
pub fn options(&self) -> &ProducerOptions
producer options
sourcepub async fn close_producer<S: Into<String>>(
&mut self,
topic: S
) -> Result<(), Error>
pub async fn close_producer<S: Into<String>>( &mut self, topic: S ) -> Result<(), Error>
stops the producer
sourcepub async fn send<T: SerializeMessage + Sized, S: Into<String>>(
&mut self,
topic: S,
message: T
) -> Result<SendFuture, Error>
👎Deprecated: instead use send_non_blocking
pub async fn send<T: SerializeMessage + Sized, S: Into<String>>( &mut self, topic: S, message: T ) -> Result<SendFuture, Error>
sends one message on a topic
sourcepub async fn send_non_blocking<T: SerializeMessage + Sized, S: Into<String>>(
&mut self,
topic: S,
message: T
) -> Result<SendFuture, Error>
pub async fn send_non_blocking<T: SerializeMessage + Sized, S: Into<String>>( &mut self, topic: S, message: T ) -> Result<SendFuture, Error>
sends one message on a topic
sourcepub async fn send_all<'a, 'b, T, S, I>(
&mut self,
topic: S,
messages: I
) -> Result<Vec<SendFuture>, Error>
👎Deprecated: instead use send_all_non_blocking
pub async fn send_all<'a, 'b, T, S, I>( &mut self, topic: S, messages: I ) -> Result<Vec<SendFuture>, Error>
sends a list of messages on a topic
sourcepub async fn send_all_non_blocking<'a, 'b, T, S, I>(
&mut self,
topic: S,
messages: I
) -> Result<Vec<SendFuture>, Error>
pub async fn send_all_non_blocking<'a, 'b, T, S, I>( &mut self, topic: S, messages: I ) -> Result<Vec<SendFuture>, Error>
sends a list of messages on a topic
Auto Trait Implementations§
impl<Exe> Freeze for MultiTopicProducer<Exe>
impl<Exe> !RefUnwindSafe for MultiTopicProducer<Exe>
impl<Exe> Send for MultiTopicProducer<Exe>
impl<Exe> Sync for MultiTopicProducer<Exe>
impl<Exe> Unpin for MultiTopicProducer<Exe>
impl<Exe> !UnwindSafe for MultiTopicProducer<Exe>
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more