RabbitRouter
faststream.rabbit.shared.router.RabbitRouter #
RabbitRouter(
prefix: str = "",
handlers: Sequence[
RabbitRoute[IncomingMessage, SendableMessage]
] = (),
**kwargs: Any
)
Bases: BrokerRouter[int, IncomingMessage]
A class representing a RabbitMQ router for handling incoming messages.
METHOD | DESCRIPTION |
---|---|
__init__ | initializes the RabbitRouter object |
subscriber | decorator for subscribing to a queue and registering a handler function |
Note
The above docstring is autogenerated by docstring-gen library (https://docstring-gen.airt.ai)
Override the __init__
method of the parent class.
PARAMETER | DESCRIPTION |
---|---|
prefix | A prefix string TYPE: |
handlers | A sequence of RabbitRoute objects TYPE: |
**kwargs | Additional keyword arguments TYPE: |
RAISES | DESCRIPTION |
---|---|
NotImplementedError | If silent animals are not supported |
Note
The above docstring is autogenerated by docstring-gen library (https://docstring-gen.airt.ai)
Source code in faststream/rabbit/shared/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 abstractmethod
#
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 |
Note
The above docstring is autogenerated by docstring-gen library (https://docstring-gen.airt.ai)
Source code in faststream/broker/router.py
subscriber #
subscriber(
queue: Union[str, RabbitQueue],
*broker_args: Any,
**broker_kwargs: Any
) -> Callable[
[Callable[P_HandlerParams, T_HandlerReturn]],
HandlerCallWrapper[
IncomingMessage, P_HandlerParams, T_HandlerReturn
],
]
A function to subscribe to a RabbitMQ queue.
PARAMETER | DESCRIPTION |
---|---|
self | the instance of the class
|
queue | the queue to subscribe to, can be a string or a RabbitQueue object
|
*broker_args | additional arguments for the broker DEFAULT: |
**broker_kwargs | additional keyword arguments for the broker DEFAULT: |
RETURNS | DESCRIPTION |
---|---|
Callable[[Callable[P_HandlerParams, T_HandlerReturn]], HandlerCallWrapper[IncomingMessage, P_HandlerParams, T_HandlerReturn]] | A callable object that wraps the handler function for the incoming messages from the queue. |
RAISES | DESCRIPTION |
---|---|
TypeError | If the queue is not a string or a RabbitQueue object |
Note
The above docstring is autogenerated by docstring-gen library (https://docstring-gen.airt.ai)