Publisher class¶
fastpubsub.Publisher
¶
A class for publishing messages to a Pub/Sub topic.
Initializes the Publisher.
| PARAMETER | DESCRIPTION |
|---|---|
topic_name
|
The name of the topic.
TYPE:
|
project_id
|
An alternative project id to publish messages. If set the broker's project id will be ignored.
TYPE:
|
middlewares
|
A list of middlewares to apply.
TYPE:
|
Source code in fastpubsub/pubsub/publisher.py
publish
async
¶
Publishes a message to the topic.
| PARAMETER | DESCRIPTION |
|---|---|
data
|
The message data. |
ordering_key
|
The ordering key for the message.
TYPE:
|
attributes
|
A dictionary of message attributes. |
autocreate
|
Whether to automatically create the topic.
TYPE:
|
Source code in fastpubsub/pubsub/publisher.py
include_middleware
¶
Includes a middleware in the publisher.
| PARAMETER | DESCRIPTION |
|---|---|
middleware
|
The middleware to include.
TYPE:
|
args
|
The positional arguments used on the middleware instantiation.
TYPE:
|
kwargs
|
The keyword arguments used on the middleware instantiation.
TYPE:
|