PubSubClient class¶
fastpubsub._internal.clients.PubSubClient
¶
Creates topics and subscriptions, and publishes messages.
Initializes the PubSubClient.
| PARAMETER | DESCRIPTION |
|---|---|
project_id
|
The Google Cloud project ID.
TYPE:
|
Source code in fastpubsub/_internal/clients.py
create_topic
async
¶
Creates a topic.
| PARAMETER | DESCRIPTION |
|---|---|
topic_name
|
The name of the topic.
TYPE:
|
create_default_subscription
|
Whether to create a default subscription for the topic.
TYPE:
|
Source code in fastpubsub/_internal/clients.py
create_subscription
async
¶
create_subscription(
topic_name,
subscription_name,
retry_policy,
delivery_policy,
dead_letter_policy=None,
)
Creates a subscription.
| PARAMETER | DESCRIPTION |
|---|---|
topic_name
|
The name of the topic.
TYPE:
|
subscription_name
|
The name of the subscription.
TYPE:
|
retry_policy
|
The retry policy for the subscription.
TYPE:
|
delivery_policy
|
The delivery policy for the subscription.
TYPE:
|
dead_letter_policy
|
The dead-letter policy for the subscription.
TYPE:
|
Source code in fastpubsub/_internal/clients.py
update_subscription
async
¶
update_subscription(
topic_name,
subscription_name,
retry_policy,
delivery_policy,
dead_letter_policy=None,
)
Updates a subscription.
| PARAMETER | DESCRIPTION |
|---|---|
topic_name
|
The name of the topic.
TYPE:
|
subscription_name
|
The name of the subscription.
TYPE:
|
retry_policy
|
The retry policy for the subscription.
TYPE:
|
delivery_policy
|
The delivery policy for the subscription.
TYPE:
|
dead_letter_policy
|
The dead-letter policy for the subscription.
TYPE:
|
Source code in fastpubsub/_internal/clients.py
publish
async
¶
Publishes a message.
| PARAMETER | DESCRIPTION |
|---|---|
topic_name
|
The name of the topic.
TYPE:
|
data
|
The message data.
TYPE:
|
ordering_key
|
The ordering key for the message.
TYPE:
|
attributes
|
A dictionary of message attributes. |
| RAISES | DESCRIPTION |
|---|---|
NotFoundError
|
The topic does not exist. |