pub struct DispatchBuilder { /* private fields */ }Expand description
Allows building an outgoing RabbitMQ Dispatch iteratively.
Expects that the payload has been converted to a vector of bytes.
Implementations§
Source§impl DispatchBuilder
impl DispatchBuilder
Sourcepub fn with_bytes(self, bytes: Vec<u8>) -> Self
pub fn with_bytes(self, bytes: Vec<u8>) -> Self
Sets the payload of this Dispatch to the given bytes.
This method is specifically made to take an owned Vec<u8>, to make sure
no copying occurs and the bytes are simply moved into this dispatch.
When copying of bytes is acceptable or desired, use
with_byte_ref.
Sourcepub fn with_byte_ref(self, bytes: impl AsRef<[u8]>) -> Self
pub fn with_byte_ref(self, bytes: impl AsRef<[u8]>) -> Self
Copies the given bytes to the payload of this Dispatch.
Sourcepub fn durable(self) -> Self
pub fn durable(self) -> Self
Sets the durability flag in the AMQPProperties of this Dispatch
to “durable”.
Sourcepub fn transient(self) -> Self
pub fn transient(self) -> Self
Sets the durability flag in the AMQPProperties of this Dispatch
to “transient”.
Sourcepub fn with_priority(self, priority: u8) -> Self
pub fn with_priority(self, priority: u8) -> Self
Sets the priority in the AMQPProperties of this Dispatch to
the given value.
Sourcepub fn with_timestamp(self, timestamp: u64) -> Self
pub fn with_timestamp(self, timestamp: u64) -> Self
Sets the timestamp in the AMQPProperties of this Dispatch to
the given value.
Sourcepub fn with_current_timestamp(self) -> Self
pub fn with_current_timestamp(self) -> Self
Sets the timestamp in the AMQPProperties of this Dispatch to
the current timestamp.
Sourcepub fn with_attempt(self, attempt: u32) -> Self
pub fn with_attempt(self, attempt: u32) -> Self
Sets the attempt header of this Dispatch to the given value.
Sourcepub fn with_incremented_attempt(self) -> Self
pub fn with_incremented_attempt(self) -> Self
Increments the attempt header of this Dispatch by one. If the attempt
is not yet present, it will be assumed to be zero, and will be incremented
to one.
Sourcepub fn with_content_type<T>(self, content_type: T) -> Selfwhere
ShortString: Morph<T>,
pub fn with_content_type<T>(self, content_type: T) -> Selfwhere
ShortString: Morph<T>,
Sourcepub fn with_content_encoding<T>(self, content_encoding: T) -> Selfwhere
ShortString: Morph<T>,
pub fn with_content_encoding<T>(self, content_encoding: T) -> Selfwhere
ShortString: Morph<T>,
Sourcepub fn with_header<T>(self, key: &str, value: T) -> Self
pub fn with_header<T>(self, key: &str, value: T) -> Self
Sourcepub fn with_correlation_id<T>(self, correlation_id: T) -> Selfwhere
ShortString: Morph<T>,
pub fn with_correlation_id<T>(self, correlation_id: T) -> Selfwhere
ShortString: Morph<T>,
Sourcepub fn with_reply_to<T>(self, reply_to: T) -> Selfwhere
ShortString: Morph<T>,
pub fn with_reply_to<T>(self, reply_to: T) -> Selfwhere
ShortString: Morph<T>,
Sourcepub fn with_expiration<T>(self, expiration: T) -> Selfwhere
ShortString: Morph<T>,
pub fn with_expiration<T>(self, expiration: T) -> Selfwhere
ShortString: Morph<T>,
Sourcepub fn with_message_id<T>(self, message_id: T) -> Selfwhere
ShortString: Morph<T>,
pub fn with_message_id<T>(self, message_id: T) -> Selfwhere
ShortString: Morph<T>,
Sourcepub fn with_kind<T>(self, kind: T) -> Selfwhere
ShortString: Morph<T>,
pub fn with_kind<T>(self, kind: T) -> Selfwhere
ShortString: Morph<T>,
Sourcepub fn with_user_id<T>(self, user_id: T) -> Selfwhere
ShortString: Morph<T>,
pub fn with_user_id<T>(self, user_id: T) -> Selfwhere
ShortString: Morph<T>,
Sourcepub fn with_app_id<T>(self, app_id: T) -> Selfwhere
ShortString: Morph<T>,
pub fn with_app_id<T>(self, app_id: T) -> Selfwhere
ShortString: Morph<T>,
Sourcepub fn with_cluster_id<T>(self, cluster_id: T) -> Selfwhere
ShortString: Morph<T>,
pub fn with_cluster_id<T>(self, cluster_id: T) -> Selfwhere
ShortString: Morph<T>,
Sourcepub fn with_routing_key(self, routing_key: impl Into<String>) -> Self
pub fn with_routing_key(self, routing_key: impl Into<String>) -> Self
Defines a routing key to be used just for this dispatch.
If this method is never called, the Publisher
instead uses the routing key configured on
the Egress.