pub struct MsgProps<T>{ /* private fields */ }
aq_unstable
only.Expand description
Properties of messages that are enqueued and dequeued using advanced queuing
Warning: The type is unstable. It may be changed incompatibly by minor version upgrades.
Implementations§
Source§impl<T> MsgProps<T>
impl<T> MsgProps<T>
Sourcepub fn new(conn: &Connection) -> Result<MsgProps<T>>
pub fn new(conn: &Connection) -> Result<MsgProps<T>>
Creates a new message properties
Sourcepub fn num_attempts(&self) -> Result<i32>
pub fn num_attempts(&self) -> Result<i32>
Returns the number of attempts that have been made to dequeue a message.
Sourcepub fn correlation(&self) -> Result<String>
pub fn correlation(&self) -> Result<String>
Returns the correlation supplied by the producer when the message was enqueued.
Sourcepub fn delay(&self) -> Result<Duration>
pub fn delay(&self) -> Result<Duration>
Returns the duration the enqueued message will be delayed.
Sourcepub fn delivery_mode(&self) -> Result<MessageDeliveryMode>
pub fn delivery_mode(&self) -> Result<MessageDeliveryMode>
Returns the mode that was used to deliver the message.
Sourcepub fn exception_queue(&self) -> Result<String>
pub fn exception_queue(&self) -> Result<String>
Returns the name of the queue to which the message is moved if it cannot be processed successfully.
See set_exception_queue
method for more information.
Sourcepub fn expiration(&self) -> Result<Duration>
pub fn expiration(&self) -> Result<Duration>
Returns the duration the message is available to be dequeued.
See set_expiration
method for more information.
Sourcepub fn message_id(&self) -> Result<Vec<u8>>
pub fn message_id(&self) -> Result<Vec<u8>>
Returns the id of the message in the queue that generated this message. No value is available until the message has been enqueued or dequeued.
Sourcepub fn original_message_id(&self) -> Result<Vec<u8>>
pub fn original_message_id(&self) -> Result<Vec<u8>>
Returns the id of the message in the last queue that generated this message.
See set_original_message_id
for more information.
Sourcepub fn payload(&self) -> Result<T::Owned>
pub fn payload(&self) -> Result<T::Owned>
Returns the payload associated with the message properties.
The payload is available after the a call to Queue.dequeue
or
Queue.dequeue_many
Sourcepub fn priority(&self) -> Result<i32>
pub fn priority(&self) -> Result<i32>
Returns the priority assigned to the message.
See set_priority
method for more information.
Sourcepub fn state(&self) -> Result<MessageState>
pub fn state(&self) -> Result<MessageState>
Returns the state of the message at the time of dequeue.
Sourcepub fn set_correlation(&mut self, val: &str) -> Result<()>
pub fn set_correlation(&mut self, val: &str) -> Result<()>
Sets the correlation of the message to be dequeued.
Special pattern matching characters such as the percent
sign (%
) and the underscore (_
) can be used. If multiple
messages satisfy the pattern, the order of dequeuing is
undetermined.
Sourcepub fn set_delay(&mut self, val: &Duration) -> Result<()>
pub fn set_delay(&mut self, val: &Duration) -> Result<()>
Sets the number of seconds to delay the message before it can be dequeued.
Messages enqueued with a delay are put into the MessageState::Waiting
state. When the delay expires the message is put into the
MessageState::Ready
state. Dequeuing directly by message id overrides this
delay specification. Note that delay processing requires the queue monitor
to be started.
Sourcepub fn set_exception_queue(&mut self, val: &str) -> Result<()>
pub fn set_exception_queue(&mut self, val: &str) -> Result<()>
Sets the name of the queue to which the message is moved if it cannot be processed successfully.
Messages are moved if the number of unsuccessful
dequeue attempts has reached the maximum allowed number or if the message
has expired. All messages in the exception queue are in the
MessageState::Expired
state.
Sourcepub fn set_expiration(&mut self, val: &Duration) -> Result<()>
pub fn set_expiration(&mut self, val: &Duration) -> Result<()>
Sets the number of seconds the message is available to be dequeued.
This value is an offset from the delay. Expiration processing requires the queue
monitor to be running. Until this time elapses, the messages are in the
queue in the state MessageState::Ready
. After this time elapses messages
are moved to the exception queue in the MessageState::Expired
state.
Sourcepub fn set_original_message_id(&mut self, val: &[u8]) -> Result<()>
pub fn set_original_message_id(&mut self, val: &[u8]) -> Result<()>
Sets the id of the message in the last queue that generated this message.
Sourcepub fn set_payload(&mut self, val: &T) -> Result<()>
pub fn set_payload(&mut self, val: &T) -> Result<()>
Sets the payload for the message.
This value will be used when the message is enqueued using
Queue.enqueue
or Queue.enqueue_many
.
Sourcepub fn set_priority(&mut self, val: i32) -> Result<()>
pub fn set_priority(&mut self, val: i32) -> Result<()>
Sets the priority assigned to the message.
A smaller number indicates a higher priority. The priority can be any number, including negative numbers.