fix: defer blocked deliveries, claim owner token

This commit is contained in:
2026-10-26 00:33:29 +01:00
parent 53892847f2
commit 0236a488fa
13 changed files with 528 additions and 80 deletions

View File

@@ -148,6 +148,11 @@ pub enum DomainEvent {
pub trait AckHandle: Send + Sync {
async fn ack(&self) -> Result<(), DomainError>;
async fn nack(&self) -> Result<(), DomainError>;
/// Redeliver after `delay` without counting a failed attempt: for a
/// delivery that was not tried (it is blocked behind a live claim), so it
/// must not burn the retry budget that `nack` spends. A broker may still
/// count the redelivery itself: JetStream does, toward `max_deliver`.
async fn defer(&self, delay: std::time::Duration) -> Result<(), DomainError>;
}
/// Stable identity of one queued event; the key for de-duplicating deliveries.
@@ -194,6 +199,10 @@ impl EventEnvelope {
self.ack.ack().await
}
pub async fn defer(self, delay: std::time::Duration) -> Result<(), DomainError> {
self.ack.defer(delay).await
}
pub async fn nack(self) -> Result<(), DomainError> {
self.ack.nack().await
}