pub struct PulsarMessage { /* private fields */ }Expand description
A message delivered by a PulsarSubscriber.
ack acknowledges; nack(requeue = true) asks the broker to redeliver, which is what
drives the delivery count towards the subscription’s dead-letter policy.
nack(requeue = false) acknowledges too: Pulsar settles a message by acknowledging it or
asking for it again, and a poison message leaves through the dead-letter policy, reached by
repeated redelivery. The client queues acknowledgements asynchronously, so Ok means
“queued”, not “broker confirmed”.
nack_after(delay) is the delayed form, and the delay is this process’s: Pulsar’s negative
acknowledgement carries none, so the delivery is held unacknowledged until the delay is over
and the negative acknowledgement goes out then. The redelivery itself is the broker’s, and so
is the count it advances.
Implementations§
Source§impl PulsarMessage
impl PulsarMessage
Trait Implementations§
Source§impl BuildBatchContext<PulsarMessage> for PulsarBatchContext
impl BuildBatchContext<PulsarMessage> for PulsarBatchContext
Source§fn build(first: &PulsarMessage) -> Self
fn build(first: &PulsarMessage) -> Self
Source§impl BuildContext<PulsarMessage> for PulsarContext
impl BuildContext<PulsarMessage> for PulsarContext
Source§fn build(msg: &PulsarMessage) -> Self
fn build(msg: &PulsarMessage) -> Self
msg.Source§impl Debug for PulsarMessage
impl Debug for PulsarMessage
Source§impl IncomingMessage for PulsarMessage
impl IncomingMessage for PulsarMessage
Source§fn supports_nack_after(&self) -> bool
fn supports_nack_after(&self) -> bool
The delay is kept by this process rather than by the broker, and that is still native delayed redelivery as far as the framework is concerned: no copy of the message is published, and the redelivery that follows is the broker’s own, counted by the consumer’s dead-letter policy like any other.
Source§fn nack_after(
self,
delay: Duration,
) -> impl Future<Output = Result<(), AckError>> + Send
fn nack_after( self, delay: Duration, ) -> impl Future<Output = Result<(), AckError>> + Send
Holds the delivery unacknowledged for delay, then negatively acknowledges it so the
broker redelivers.
The wait runs on a task of its own, started by the subscription’s driver on the runtime
the broker connected on: the dispatch loop must not stop for it, and a handler on a
dedicated thread may settle from a runtime that stops before the delay is out. The
delivery’s settlement channel keeps the driver alive until the wait is over. Ok
therefore means the delay was accepted, not that the redelivery has happened yet.
§Errors
Returns AckError::Broker when the delay is not shorter than the subscription’s
ack_timeout, which would redeliver the message before the delay was over, or when the
subscription is gone (its driver task has shut down, or in process the broker did).
§Cancel safety
At-most-once over the delay window: the message is unacknowledged throughout, so a process
that exits before the wait ends loses only the wait. The broker redelivers the message
once the consumer’s ack_timeout elapses, and at once where the consumer disconnects.
Source§async fn ack(self) -> Result<(), AckError>
async fn ack(self) -> Result<(), AckError>
Source§async fn nack(self, requeue: bool) -> Result<(), AckError>
async fn nack(self, requeue: bool) -> Result<(), AckError>
requeue is true the broker should
redeliver according to its own retry policy; when false it should drop or dead-letter
the message. Read moreSource§fn partition_key(&self) -> Option<&[u8]>
fn partition_key(&self) -> Option<&[u8]>
None when the
message carries no key. Read moreSource§fn redelivery_count(&self) -> Option<u64>
fn redelivery_count(&self) -> Option<u64>
None
where the transport counts nothing. Read moreSource§fn decode_error(&self) -> Option<&CodecError>
fn decode_error(&self) -> Option<&CodecError>
None when it read the delivery
whole. Read moreSource§impl Partitioned for PulsarMessage
impl Partitioned for PulsarMessage
Source§fn partition_key(&self) -> Option<&[u8]>
fn partition_key(&self) -> Option<&[u8]>
None if the broker should pick a partition.Source§impl Positioned for PulsarMessage
impl Positioned for PulsarMessage
Source§type Position = PulsarPosition
type Position = PulsarPosition
Seeker::Position.Source§fn position(&self) -> PulsarPosition
fn position(&self) -> PulsarPosition
Auto Trait Implementations§
impl !Freeze for PulsarMessage
impl RefUnwindSafe for PulsarMessage
impl Send for PulsarMessage
impl Sync for PulsarMessage
impl Unpin for PulsarMessage
impl UnsafeUnpin for PulsarMessage
impl UnwindSafe for PulsarMessage
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> 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