pub struct LapinRequester { /* private fields */ }Expand description
A request/reply client over RabbitMQ direct reply-to.
request publishes to the routing key named by
OutgoingMessage::name (on the default exchange unless exchange says
otherwise) with reply-to set to the direct reply-to pseudo-queue and a generated
correlation-id; the responder replies by publishing to the reply-to it received, echoing
the correlation-id.
Direct reply-to is at-most-once: replies live in channel state on one broker node, so a dropped requester channel loses in-flight replies. The per-request timeout is the recovery mechanism.
Requests are published transient (delivery mode 1) by default: a request nobody is waiting
for after the timeout gains nothing from surviving a broker restart. Opt into persistence
with persistent(true).
Obtained from LapinBroker::requester. Clones share the
reply consumer and the pending-request table.
Implementations§
Trait Implementations§
Source§impl Clone for LapinRequester
impl Clone for LapinRequester
Source§fn clone(&self) -> LapinRequester
fn clone(&self) -> LapinRequester
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for LapinRequester
impl Debug for LapinRequester
Source§impl Publisher for LapinRequester
impl Publisher for LapinRequester
Source§async fn publish(&self, msg: OutgoingMessage<'_>) -> Result<(), Self::Error>
async fn publish(&self, msg: OutgoingMessage<'_>) -> Result<(), Self::Error>
Publishes msg on the requester channel without expecting a reply.
§Errors
Returns AmqpError::NotConnected before Broker::connect resolves the connection and
AmqpError::Publish when the channel rejects the frame.
§Cancel safety
Not cancel safe: dropping the future may leave the message published or not.
Source§impl RequestReply for LapinRequester
impl RequestReply for LapinRequester
Source§async fn request(
&self,
msg: OutgoingMessage<'_>,
timeout: Duration,
) -> Result<Self::Reply, Self::Error>
async fn request( &self, msg: OutgoingMessage<'_>, timeout: Duration, ) -> Result<Self::Reply, Self::Error>
Sends msg and awaits the correlated reply.
§Errors
Returns AmqpError::RequestTimeout when no reply arrives within timeout,
AmqpError::NotConnected before Broker::connect resolves the connection, and
AmqpError::Request / AmqpError::Publish on channel failures.
§Cancel safety
Cancel safe for the caller’s state: dropping the future abandons the pending slot and a late reply is discarded. The request itself may still have been published.