Struct rocketmq::model::message::MessageBuilder
source · pub struct MessageBuilder { /* private fields */ }Expand description
MessageBuilder is the builder for Message.
Implementations§
source§impl MessageBuilder
impl MessageBuilder
sourcepub fn builder() -> MessageBuilder
pub fn builder() -> MessageBuilder
Create a new MessageBuilder for building a message. Read more
sourcepub fn fifo_message_builder(
topic: impl Into<String>,
body: Vec<u8>,
message_group: impl Into<String>
) -> MessageBuilder
pub fn fifo_message_builder( topic: impl Into<String>, body: Vec<u8>, message_group: impl Into<String> ) -> MessageBuilder
Create a new MessageBuilder for building a fifo message. Read more
Arguments
topic- topic of the messagebody- message bodymessage_group- message group, messages with same message group will be delivered in FIFO order
sourcepub fn delay_message_builder(
topic: impl Into<String>,
body: Vec<u8>,
delay_time: i64
) -> MessageBuilder
pub fn delay_message_builder( topic: impl Into<String>, body: Vec<u8>, delay_time: i64 ) -> MessageBuilder
Create a new MessageBuilder for building a delay message. Read more
Arguments
topic- topic of the messagebody- message bodydelay_time- delivery timestamp of message, specify when to deliver the message
sourcepub fn transaction_message_builder(
topic: impl Into<String>,
body: Vec<u8>
) -> MessageBuilder
pub fn transaction_message_builder( topic: impl Into<String>, body: Vec<u8> ) -> MessageBuilder
Create a new MessageBuilder for building a transaction message. Read more
Arguments
topic- topic of the messagebody- message body
sourcepub fn set_topic(self, topic: impl Into<String>) -> Self
pub fn set_topic(self, topic: impl Into<String>) -> Self
Set topic for message, which is required
sourcepub fn set_properties(
self,
properties: HashMap<impl Into<String>, impl Into<String>>
) -> Self
pub fn set_properties( self, properties: HashMap<impl Into<String>, impl Into<String>> ) -> Self
Set message properties
sourcepub fn set_message_group(self, message_group: impl Into<String>) -> Self
pub fn set_message_group(self, message_group: impl Into<String>) -> Self
Set message group, which is required for fifo message. Read more
The message group could not be set with delivery timestamp at the same time
sourcepub fn set_delivery_timestamp(self, delivery_timestamp: i64) -> Self
pub fn set_delivery_timestamp(self, delivery_timestamp: i64) -> Self
Set delivery timestamp, which is required for delay message. Read more
The delivery timestamp could not be set with message group at the same time
sourcepub fn enable_transaction(self) -> Self
pub fn enable_transaction(self) -> Self
Mark this message as the beginning transaction, which is required for the transaction message. Read more
The transaction message could not have message group and delivery timestamp
sourcepub fn build(self) -> Result<impl Message, ClientError>
pub fn build(self) -> Result<impl Message, ClientError>
Build message
Auto Trait Implementations§
impl RefUnwindSafe for MessageBuilder
impl Send for MessageBuilder
impl Sync for MessageBuilder
impl Unpin for MessageBuilder
impl UnwindSafe for MessageBuilder
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
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> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request