KvParser faststream.nats.parser.KvParser # KvParser(*, pattern) Bases: NatsBaseParser Source code in faststream/nats/parser.py 23 24 25 26 27 28 29def __init__( self, *, pattern: str, ) -> None: path_re, _ = compile_nats_wildcard(pattern) self.__path_re = path_re get_path # get_path(subject) Source code in faststream/nats/parser.py 31 32 33 34 35 36 37 38 39 40 41 42def get_path( self, subject: str, ) -> Optional["AnyDict"]: path: Optional[AnyDict] = None if (path_re := self.__path_re) is not None and ( match := path_re.match(subject) ) is not None: path = match.groupdict() return path decode_message async # decode_message(msg) Source code in faststream/nats/parser.py 44 45 46 47 48async def decode_message( self, msg: "StreamMessage[Any]", ) -> "DecodedMessage": return decode_message(msg) parse_message async # parse_message(msg) Source code in faststream/nats/parser.py 157 158 159 160 161 162 163 164async def parse_message( self, msg: "KeyValue.Entry" ) -> StreamMessage["KeyValue.Entry"]: return NatsKvMessage( raw_message=msg, body=msg.value, path=self.get_path(msg.key) or {}, )