diff --git a/faststream/rabbit/broker/broker.py b/faststream/rabbit/broker/broker.py index bae55992e9..7f03343719 100644 --- a/faststream/rabbit/broker/broker.py +++ b/faststream/rabbit/broker/broker.py @@ -624,25 +624,44 @@ async def publish( Please, use @broker.publisher(...) or broker.publisher(...).publish(...) for the regular method of publishing. Args: - message: Message body to send. - queue: Message routing key to publish with. - exchange: Target exchange to publish message to. - routing_key: Message routing key to publish with. Overrides `queue` option if presented. - mandatory: Client waits for confirmation that the message is placed to some queue. RabbitMQ returns message to client if there is no suitable queue. - immediate: Client expects that there is consumer ready to take the message to work. RabbitMQ returns message to client if there is no suitable consumer. - timeout: Send confirmation time from RabbitMQ. - persist: Restore the message on RabbitMQ reboot. - reply_to: Reply message routing key to send with (always sending to default exchange). - correlation_id: Manual message **correlation_id** setter. **correlation_id** is a useful option to trace messages. - headers: Message headers to store metainformation. - content_type: Message **content-type** header. Used by application, not core RabbitMQ. Will be set automatically if not specified. - content_encoding: Message body content encoding, e.g. **gzip**. - expiration: Message expiration (lifetime) in seconds (or datetime or timedelta). - message_id: Arbitrary message id. Generated automatically if not presented. - timestamp: Message publish timestamp. Generated automatically if not presented. - message_type: Application-specific message type, e.g. **orders.created**. - user_id: Publisher connection User ID, validated if set. - priority: The message priority (0 by default). + message: + Message body to send. + queue: + Message routing key to publish with. + exchange: + Target exchange to publish message to. + routing_key: + Message routing key to publish with. Overrides `queue` option if presented. + mandatory: + Client waits for confirmation that the message is placed to some queue. RabbitMQ returns message to client if there is no suitable queue. + immediate: + Client expects that there is consumer ready to take the message to work. RabbitMQ returns message to client if there is no suitable consumer. + timeout: + Send confirmation time from RabbitMQ. + persist: + Restore the message on RabbitMQ reboot. + reply_to: + Reply message routing key to send with (always sending to default exchange). + correlation_id: + Manual message **correlation_id** setter. **correlation_id** is a useful option to trace messages. + headers: + Message headers to store metainformation. + content_type: + Message **content-type** header. Used by application, not core RabbitMQ. Will be set automatically if not specified. + content_encoding: + Message body content encoding, e.g. **gzip**. + expiration: + Message expiration (lifetime) in seconds (or datetime or timedelta). + message_id: + Arbitrary message id. Generated automatically if not presented. + timestamp: + Message publish timestamp. Generated automatically if not presented. + message_type: + Application-specific message type, e.g. **orders.created**. + user_id: + Publisher connection User ID, validated if set. + priority: + The message priority (0 by default). Returns: An optional aiormq.abc.ConfirmationFrameType representing the confirmation frame if RabbitMQ is configured to send confirmations. diff --git a/faststream/redis/broker/broker.py b/faststream/redis/broker/broker.py index 660785730b..c98ed811ab 100644 --- a/faststream/redis/broker/broker.py +++ b/faststream/redis/broker/broker.py @@ -417,14 +417,22 @@ async def publish( # type: ignore[override] It can be used in other frameworks or to publish messages at specific intervals. Args: - message: Message body to send. - channel: Redis PubSub object name to send message. - reply_to: Reply message destination PubSub object name. - headers: Message headers to store metainformation. - correlation_id: Manual message correlation_id setter. correlation_id is a useful option to trace messages. - list: Redis List object name to send message. - stream: Redis Stream object name to send message. - maxlen: Redis Stream maxlen publish option. Remove eldest message if maxlen exceeded. + message: + Message body to send. + channel: + Redis PubSub object name to send message. + reply_to: + Reply message destination PubSub object name. + headers: + Message headers to store metainformation. + correlation_id: + Manual message correlation_id setter. correlation_id is a useful option to trace messages. + list: + Redis List object name to send message. + stream: + Redis Stream object name to send message. + maxlen: + Redis Stream maxlen publish option. Remove eldest message if maxlen exceeded. Returns: int: The result of the publish operation, typically the number of messages published.