If you have ever used the Cloud Academy Android application, you should be aware that you have the option to subscribe to our platform by paying through Google Pay. We offered this option because most mobile users nowadays prefer paying with integrated payment systems offered by both Android and iOS.
The Challenge
Because of this integration in the Cloud Academy mobile application, we needed to think about implementation to support Google Subscriptions.
We reached the Google doc and learned that for every subscription action, such as a subscription creation or a renewal, we would receive a notification generated by the Google Pay service. Google sends all notifications to a Google Cloud Pub/Sub topic which we needed to specify.
So the challenge was: How can we handle loads of subscription notifications in an efficient, reliable, and fault-tolerant way?
Google Cloud Pub/Sub
Luckily for us, all the Google Pay notifications are sent to a Google Cloud Pub/Sub topic that we can access to reach them.
Before going through the solution that we implemented, I want to give you a high-level overview of what Pub/Sub is. Google Cloud Pub/Sub is a messaging-oriented middleware that lets you decouple services that create messages (the Publishers) from services that process messages (the Subscribers).
The core components in a Pub/Sub solution are the following:

Topics: An entry point for the publishers that want to publish messages.
Subscriptions: An entity associated with a specific topic and that is used by the subscribers to receive messages published on the topic the subscription is associated with.

There are two kinds of subscriptions.
Pull Subscriptions
A pull subscription is used when the subscriber wants to manually get all the messages that have been published on the topic the subscription is associated with. In this case, the subscriber makes a pull call, receives the messages, and then sends an ACK (acknowledge) to let Pub/Sub know

View Entire Article on CloudStorageAcademy.com