RedisRouter
faststream.redis.shared.router.RedisRouter #
RedisRouter(
prefix: str = "",
handlers: Sequence[
BrokerRoute[AnyRedisDict, SendableMessage]
] = (),
**kwargs: Any
)
Bases: BrokerRouter[int, AnyRedisDict]
A class to represent a Redis router.
Initialize the Redis router.
PARAMETER | DESCRIPTION |
---|---|
prefix | The prefix. TYPE: |
handlers | The handlers. TYPE: |
**kwargs | The keyword arguments. TYPE: |
Source code in faststream/redis/shared/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 abstractmethod
#
publisher(
subj: str, *args: Any, **kwargs: Any
) -> BasePublisher[MsgType]
Publishes a message.
PARAMETER | DESCRIPTION |
---|---|
subj | Subject of the message TYPE: |
*args | Additional arguments TYPE: |
**kwargs | Additional keyword arguments TYPE: |
RETURNS | DESCRIPTION |
---|---|
BasePublisher[MsgType] | The published message |
RAISES | DESCRIPTION |
---|---|
NotImplementedError | If the method is not implemented |
Source code in faststream/broker/router.py
subscriber #
subscriber(
channel: Union[Channel, PubSub, None] = None,
*,
list: Union[Channel, ListSub, None] = None,
stream: Union[Channel, StreamSub, None] = None,
**broker_kwargs: Any
) -> Callable[
[Callable[P_HandlerParams, T_HandlerReturn]],
HandlerCallWrapper[
AnyRedisDict, P_HandlerParams, T_HandlerReturn
],
]