pub struct RequestReservation { /* private fields */ }Expand description
Route credit, writer capacity and a correlation id reserved for one request.
Dropping this value without calling Self::send sends nothing and releases
both the route credit and the writer slot.
Implementations§
Source§impl RequestReservation
impl RequestReservation
Sourcepub fn correlation_id(&self) -> CorrelationId
pub fn correlation_id(&self) -> CorrelationId
The id already assigned to this request, also returned by Self::send.
Sourcepub fn send(
self,
body: RequestBody,
opts: CallOptions,
) -> (CorrelationId, PendingReply)
pub fn send( self, body: RequestBody, opts: CallOptions, ) -> (CorrelationId, PendingReply)
Synchronously hand the request to the connection’s writer queue. No reply polling or socket I/O happens here.
Queued is not on the wire. If the connection fails after queuing, before
or after writing, PendingReply returns the same connection-loss errors
as SubcConsumer::request. A connection-loss error alone does not tell
you whether the module saw the request; include your own idempotency key
in the body for safe retries when the outcome is uncertain. If the route
closed since reservation, the writer skips the frame and the reply
returns the same closed-route error as an ordinary unwritten request.
Only opts.priority and opts.admission_class apply to this already-open
route. The deadline supplied to SubcConsumer::reserve governs the
entire request, including the reply; opts.timeout does not replace it.
A non-None opts.scope is an argument error returned by the reply,
without queuing a frame. Select the scope when opening the route instead.