Bases: StreamMessage[Msg]
A class to represent a NATS message.
raw_message instance-attribute
path class-attribute
instance-attribute
content_type class-attribute
instance-attribute
reply_to class-attribute
instance-attribute
message_id class-attribute
instance-attribute
correlation_id class-attribute
instance-attribute
processed class-attribute
instance-attribute
processed = field(default=False, init=False)
committed class-attribute
instance-attribute
committed = field(default=None, init=False)
decoded_body property
writable
decode async
Serialize the message by lazy decoder.
Source code in faststream/broker/message.py
| async def decode(self) -> Optional["DecodedMessage"]:
"""Serialize the message by lazy decoder."""
# TODO: make it lazy after `decoded_body` removed
return self._decoded_body
|
ack async
Source code in faststream/nats/message.py
| async def ack(self) -> None:
# Check `self.raw_message._ackd` instead of `self.committed`
# to be compatible with `self.raw_message.ack()`
if not self.raw_message._ackd:
await self.raw_message.ack()
await super().ack()
|
ack_sync async
Source code in faststream/nats/message.py
| async def ack_sync(self) -> None:
if not self.raw_message._ackd:
await self.raw_message.ack_sync()
await super().ack()
|
nack async
Source code in faststream/nats/message.py
| async def nack(
self,
delay: Union[int, float, None] = None,
) -> None:
if not self.raw_message._ackd:
await self.raw_message.nak(delay=delay)
await super().nack()
|
reject async
Source code in faststream/nats/message.py
| async def reject(self) -> None:
if not self.raw_message._ackd:
await self.raw_message.term()
await super().reject()
|
in_progress async
Source code in faststream/nats/message.py
| async def in_progress(self) -> None:
if not self.raw_message._ackd:
await self.raw_message.in_progress()
|