Skip to content

AsyncPublisherProtocol

faststream.broker.types.AsyncPublisherProtocol #

Bases: Protocol

A protocol for an asynchronous publisher.

METHOD DESCRIPTION
publish

SendableMessage, correlation_id: Optional[str] = None, **kwargs: Any) -> Optional[SendableMessage]: Publishes a message asynchronously.

Args: message: The message to be published. correlation_id: The correlation ID for the message (optional). **kwargs: Additional keyword arguments.

Returns: The published message (optional).

Note

The above docstring is autogenerated by docstring-gen library (https://docstring-gen.airt.ai)

publish async #

publish(
    message: SendableMessage,
    correlation_id: Optional[str] = None,
    **kwargs: Any
) -> Optional[SendableMessage]

Publishes a message.

PARAMETER DESCRIPTION
message

The message to be published.

TYPE: SendableMessage

correlation_id

Optional correlation ID for the message.

TYPE: Optional[str] DEFAULT: None

**kwargs

Additional keyword arguments.

TYPE: Any DEFAULT: {}

RETURNS DESCRIPTION
Optional[SendableMessage]

The published message, or None if the message was not published.

Note

The above docstring is autogenerated by docstring-gen library (https://docstring-gen.airt.ai)

Source code in faststream/broker/types.py
async def publish(
    self,
    message: SendableMessage,
    correlation_id: Optional[str] = None,
    **kwargs: Any,
) -> Optional[SendableMessage]:
    """Publishes a message.

    Args:
        message: The message to be published.
        correlation_id: Optional correlation ID for the message.
        **kwargs: Additional keyword arguments.

    Returns:
        The published message, or None if the message was not published.
    !!! note

        The above docstring is autogenerated by docstring-gen library (https://docstring-gen.airt.ai)
    """
    ...

Last update: 2023-11-13