NatsRouter
faststream.nats.router.NatsRouter #
NatsRouter(prefix: str = '', handlers: Sequence[NatsRoute] = (), *, dependencies: Sequence[Depends] = (), middlewares: Sequence[Callable[[Msg], BaseMiddleware]] | None = None, parser: CustomParser[Msg, NatsMessage] | None = None, decoder: CustomDecoder[NatsMessage] | None = None, include_in_schema: bool = True)
Bases: NatsRouter
A class to represent a NATS router.
Source code in faststream/nats/router.py
include_router #
include_router(router: BrokerRouter[PublisherKeyType, MsgType]) -> None
Includes a router in the current object.
PARAMETER | DESCRIPTION |
---|---|
router | The router to be included. TYPE: |
RETURNS | DESCRIPTION |
---|---|
None | None |
Source code in faststream/broker/router.py
include_routers #
include_routers(*routers: BrokerRouter[PublisherKeyType, MsgType]) -> None
Includes routers in the object.
PARAMETER | DESCRIPTION |
---|---|
*routers | Variable length argument list of routers to include. TYPE: |
RETURNS | DESCRIPTION |
---|---|
None | None |
Source code in faststream/broker/router.py
publisher #
publisher(subject: str, headers: dict[str, str] | None = None, reply_to: str = '', title: str | None = None, description: str | None = None, schema: Any | None = None, include_in_schema: bool = True) -> Publisher
Source code in faststream/nats/router.py
subscriber #
subscriber(subject: str, queue: str = '', pending_msgs_limit: int | None = None, pending_bytes_limit: int | None = None, max_msgs: int = 0, ack_first: bool = False, stream: str | JStream | None = None, durable: str | None = None, config: ConsumerConfig | None = None, ordered_consumer: bool = False, idle_heartbeat: float | None = None, flow_control: bool = False, deliver_policy: DeliverPolicy | None = None, headers_only: bool | None = None, pull_sub: PullSub | None = None, inbox_prefix: bytes = api.INBOX_PREFIX, dependencies: Sequence[Depends] = (), parser: CustomParser[Msg, NatsMessage] | None = None, decoder: CustomDecoder[NatsMessage] | None = None, middlewares: Sequence[Callable[[Msg], BaseMiddleware]] | None = None, filter: Filter[NatsMessage] = default_filter, retry: bool = False, no_ack: bool = False, title: str | None = None, description: str | None = None, include_in_schema: bool = True, **__service_kwargs: Any) -> Callable[[Callable[P_HandlerParams, T_HandlerReturn]], HandlerCallWrapper[Msg, P_HandlerParams, T_HandlerReturn]]