google.pubsub
Platypush documentation
google.pubsub
- class platypush.backend.google.pubsub.GooglePubsubBackend(topics: List[str], credentials_file: Optional[str] = None, *args, **kwargs)[source]
Bases:
Backend
- Subscribe to a list of topics on a Google Pub/Sub instance. See
platypush.plugins.google.pubsub.GooglePubsubPlugin
for a reference on how to generate your project and credentials file.
Triggers:
platypush.message.event.google.pubsub.GooglePubsubMessageEvent
when a new message is received on a subscribed topic.
Requires:
google-cloud-pubsub (
pip install google-cloud-pubsub
)
- __init__(topics: List[str], credentials_file: Optional[str] = None, *args, **kwargs)[source]
- Parameters:
topics – List of topics to subscribe. You can either specify the full topic name in the format
projects/<project_id>/topics/<topic_name>
, where<project_id>
must be the ID of your Google Pub/Sub project, or just<topic_name>
- in such case it’s implied that you refer to thetopic_name
under theproject_id
of your service credentials.credentials_file – Path to the Pub/Sub service credentials file (default: value configured on the
google.pubsub
plugin or~/.credentials/platypush/google/pubsub.json
).