google.pubsub#

class platypush.backend.google.pubsub.GooglePubsubBackend(topics: List[str], credentials_file: str | None = 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:

Requires:

  • google-cloud-pubsub (pip install google-cloud-pubsub)

__init__(topics: List[str], credentials_file: str | None = 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 the topic_name under the project_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).

run()[source]#

Starts the backend thread. To be implemented in the derived classes if the loop method isn’t defined.