pub struct Retry;Expand description
The marker of a registration’s deferred-retry slot: .out(Retry, policy) names the publish
policy a retry_after copy leaves through.
The slot is an ordinary Out position, so the chain after the call takes the
steps every slot takes: .codec(..) names the position’s codec, .transform(..) composes a
PublishTransform the copy travels through, and a
broker’s own publisher settings reach the
policy through map_publisher. The deferred copy is
already serialized - it is the delivery’s own bytes with the retry count incremented - so it
passes the codec by, the way a Serialized value does on any slot.
The position is filled before the call: every registration whose subscription declares
AddressedCopies or
NamedCopies gets a publisher from the broker’s own
DefaultPublish policy, and this call replaces it. On a descriptor
that declares BrokerMoves the call does not compile: the broker moves
the delivery itself and there is nothing of this process’s to publish. It comes after the
registration’s declaration, max_attempts and
dead_letter.
Where a copy goes is the subscription’s own answer, read at startup from
RedeliveryAddressed: a
subscription name and a publish destination are one string on a subject or a topic, and
separate resources on Google Pub/Sub. A registration over a subscription which publishes its
copies here and reports no address refuses to start, naming the subscription and its
descriptor, instead of publishing copies into nothing once a handler asks for a delay. The slot
therefore never lets a transform name the destination, and the generated AsyncAPI document
ignores the position: a copy goes to the subscription’s own address, or to the declared
dead-letter destination, and neither is this position’s to name.
Brokers with native delayed redelivery do not need the position: the runtime uses their
nack_after instead, and no copy is published there.
§Cancel safety
The deferred copy is at-most-once over the delay window: see
HandlerOutcome::retry_after.
§Examples
use std::time::Duration;
use ruststream::memory::prelude::*;
#[subscriber("orders")]
async fn reconcile(order: &Order) -> HandlerOutcome {
let _ = order.id;
HandlerOutcome::retry_after(Duration::from_secs(30))
}
fn app() -> RustStream {
RustStream::new(AppInfo::new("orders", "0.1.0")).with_broker(MemoryBroker::new(), |b| {
b.include(reconcile).out(Retry, Publish);
})
}Trait Implementations§
impl Copy for Retry
impl Eq for Retry
Source§impl OutSlot for Retry
impl OutSlot for Retry
Source§const NAME: &'static str = "Retry"
const NAME: &'static str = "Retry"
Source§type Destination = Reads
type Destination = Reads
Source§fn outgoing() -> Vec<OutgoingMessageMetadata>
fn outgoing() -> Vec<OutgoingMessageMetadata>
AsyncAPI metadata, one entry per
#[publishes(..)] type. The derive fills this in; the default (a marker without a
dictionary) publishes nothing declared. Called once at registration; never on the
publish path.impl StructuralPartialEq for Retry
Auto Trait Implementations§
impl Freeze for Retry
impl RefUnwindSafe for Retry
impl Send for Retry
impl Sync for Retry
impl Unpin for Retry
impl UnsafeUnpin for Retry
impl UnwindSafe for Retry
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
self with key and returns true if they are equal.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> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more