Publisher
faststream.rabbit.asyncapi.Publisher dataclass
#
Publisher(queue: RabbitQueue = RabbitQueue(''), exchange: Optional[RabbitExchange] = None, _description: Optional[str] = None, virtual_host: str = '/', include_in_schema: bool = True, title: Optional[str] = None, _schema: Optional[Any] = None, _fake_handler: bool = False, routing_key: str = '', mandatory: bool = True, immediate: bool = False, persist: bool = False, timeout: TimeoutType = None, reply_to: Optional[str] = None, priority: Optional[int] = None, message_kwargs: AnyDict = dict())
Bases: LogicPublisher
A class representing a publisher.
METHOD | DESCRIPTION |
---|---|
get_payloads | Get the payloads for the publisher |
calls class-attribute
instance-attribute
#
exchange class-attribute
instance-attribute
#
exchange: Optional[RabbitExchange] = field(default=None)
include_in_schema class-attribute
instance-attribute
#
message_kwargs class-attribute
instance-attribute
#
mock class-attribute
instance-attribute
#
get_payloads #
Source code in faststream/broker/publisher.py
publish async
#
publish(message: AioPikaSendableMessage = '', *, rpc: bool = False, rpc_timeout: float | None = 30.0, raise_timeout: bool = False, correlation_id: str | None = None, priority: int | None = None, **message_kwargs: Any) -> ConfirmationFrameType | SendableMessage
Publish a message.
PARAMETER | DESCRIPTION |
---|---|
message | The message to be published. TYPE: |
rpc | Whether the message is for RPC (Remote Procedure Call). TYPE: |
rpc_timeout | Timeout for RPC. TYPE: |
raise_timeout | Whether to raise an exception if timeout occurs. TYPE: |
correlation_id | Correlation ID for the message. TYPE: |
priority | Priority for the message. TYPE: |
**message_kwargs | Additional keyword arguments for the message. TYPE: |
RETURNS | DESCRIPTION |
---|---|
ConfirmationFrameType | SendableMessage | ConfirmationFrameType or SendableMessage: The result of the publish operation. |
RAISES | DESCRIPTION |
---|---|
AssertionError | If |