NatsRouter
faststream.nats.router.NatsRouter #
NatsRouter(
prefix: str = "",
handlers: Sequence[NatsRoute] = (),
*,
dependencies: Sequence[Depends] = (),
middlewares: Optional[
Sequence[Callable[[Msg], BaseMiddleware]]
] = None,
parser: Optional[CustomParser[Msg, NatsMessage]] = None,
decoder: Optional[CustomDecoder[NatsMessage]] = None
)
Bases: NatsRouter
Source code in faststream/nats/router.py
include_router #
Includes a router in the current object.
PARAMETER | DESCRIPTION |
---|---|
router | The router to be included. TYPE: |
RETURNS | DESCRIPTION |
---|---|
None | None |
Note
The above docstring is autogenerated by docstring-gen library (https://docstring-gen.airt.ai)
Source code in faststream/broker/router.py
include_routers #
Includes routers in the object.
PARAMETER | DESCRIPTION |
---|---|
*routers | Variable length argument list of routers to include. TYPE: |
RETURNS | DESCRIPTION |
---|---|
None | None |
Note
The above docstring is autogenerated by docstring-gen library (https://docstring-gen.airt.ai)
Source code in faststream/broker/router.py
publisher #
publisher(
subject: str,
headers: Optional[Dict[str, str]] = None,
reply_to: str = "",
title: Optional[str] = None,
description: Optional[str] = None,
schema: Optional[Any] = None,
) -> Publisher
Source code in faststream/nats/router.py
subscriber #
subscriber(
subject: str,
queue: str = "",
pending_msgs_limit: Optional[int] = None,
pending_bytes_limit: Optional[int] = None,
max_msgs: int = 0,
ack_first: bool = False,
stream: Union[str, JStream, None] = None,
durable: Optional[str] = None,
config: Optional[api.ConsumerConfig] = None,
ordered_consumer: bool = False,
idle_heartbeat: Optional[float] = None,
flow_control: bool = False,
deliver_policy: Optional[api.DeliverPolicy] = None,
headers_only: Optional[bool] = None,
pull_sub: Optional[PullSub] = None,
inbox_prefix: bytes = api.INBOX_PREFIX,
dependencies: Sequence[Depends] = (),
parser: Optional[CustomParser[Msg, NatsMessage]] = None,
decoder: Optional[CustomDecoder[NatsMessage]] = None,
middlewares: Optional[
Sequence[Callable[[Msg], BaseMiddleware]]
] = None,
filter: Filter[NatsMessage] = default_filter,
retry: bool = False,
title: Optional[str] = None,
description: Optional[str] = None,
**__service_kwargs: Any
) -> Callable[
[Callable[P_HandlerParams, T_HandlerReturn]],
HandlerCallWrapper[
Msg, P_HandlerParams, T_HandlerReturn
],
]
Last update: 2023-11-13