Skip to content

ObjParser

faststream.nats.parser.ObjParser #

ObjParser(*, pattern: str)

Bases: NatsBaseParser

Source code in faststream/nats/parser.py
def __init__(
    self,
    *,
    pattern: str,
) -> None:
    path_re, _ = compile_nats_wildcard(pattern)
    self._path_re = path_re

parse_message async #

parse_message(msg: ObjectInfo) -> StreamMessage[ObjectInfo]
Source code in faststream/nats/parser.py
async def parse_message(self, msg: "ObjectInfo") -> StreamMessage["ObjectInfo"]:
    return NatsObjMessage(
        raw_message=msg,
        body=msg.name,
    )

decode_message async #

decode_message(msg: StreamMessage[Any]) -> DecodedMessage
Source code in faststream/nats/parser.py
async def decode_message(
    self,
    msg: "StreamMessage[Any]",
) -> "DecodedMessage":
    return decode_message(msg)