Architecture of Publisher/Subscriber

Pub/Sub is an asynchronous global messaging service. By decoupling senders and receivers, it allows for secure and highly available communication between independently written applications. Pub/Sub delivers low-latency, durable messaging.

A central piece of Pub/Sub is the topic.

Have a fully operational pipeline where the publisher is sending data to a topic that an application that has subscribed to and it's pulling from.

An analogy colon radio antenna, due stream goes on. Sometimes better quality sometimes poor.

Mechanism colon Publisher -> topic -> subscriber

With one difference you may explicitly define the "audience" field when setting up the push subscription.

Create a Pub/Sub topic and a big query dataset

When to use background function, instead of push subscription

HTTP function you get a req/resp as function params. For a HTTP function you get a req/resp as function params. For background functions you get a event and context. Even Google themself are using query params for "backgroud functions".

Background functions provide the following benefits:

Best practise

  1. Created a HTTP Cloud Function with authentication enabled
  2. Created a service account with invoke access to Cloud Function
  3. Created a PubSub Push subscription and used the newly created service account