Developers
July 13, 2020

GCP Introduces Pub/Sub, a Real-Time Messaging Management Service, as a New Notification Channel

Pub/Sub is a new real-time messaging service that lets you send and receive messages between independent applications. Now, it can improve the cloud monitoring experience.

Today we will talk about a new alert system deployed by Google Cloud. Worldwide companies often look at how to make their alerting automatic. This way, companies can focus on their development rather than on operational time taking tasks. Google is one of the companies that has as a priority using their time and human resources in projects.  

Until now there was only one cloud monitoring service that alerted the user. It is called Webhook, the main notification channel. This automation allows the system to respond to errors in the applications. 

Today, Webhook stops being the only notification challenge, and Pub/Sub (PS) is added into the system. This new service is currently in beta mode and it allows the user to create automatic and programmed workflows to respond to alerts.

With PS you can easily set up configurations and alert notifications. This helps developers integrate third-party providers. PS counts with the Google Cloud Console API.  

Webhook                          

If you can use Webhook to integrate third-party packages, why use PS? Well, both methods are valid, and they apply to different situations. They differ in a couple of things, for example, invocation methods (implicit vs explicit), durability, and authentication methods.

Webbooks are used when explicit invocations are required. In these situations, the client retains maximum control over the execution process. The server is responsible for the timing and processing of alert messages.

If the message fails, Webhook tries to deliver the message again multiple times after a failure. If after the multiple requests there is no way to deliver the message, finally the notifications are not delivered.

If you already have a central incident Response Management solution, then webhook fits perfectly. The server uses endpoint URLs. This can be later used by third-party alerting solutions.

After the client invokes the Webhook, the server first receives the request and then parses it and sends the message. If something goes wrong, an incident or “to be resolved” error message is displayed.

The server is responsible for parsing the messages and many third parties send a different JSON payload. They all use one single endpoint. The option to expose separate endpoints for each third party message is also available, yet not very much used. 

What about Webhook's safety? It supports token authentication. You can use basic or token authentication to verify the caller. You as a developer are responsible for maintaining and managing the server. In this scenario, it means making sure the server is always able to receive messages.

What is Pub/Sub?

Contrary to Webhook, PS supports explicit and implicit invocations. explicit being push and implicit being pull requests. When pulling, the person requesting controls when to pull a message and how to process its alert. PS provides a queue where messages wait until they are pulled.

PS has an access-controlled feature, where access is managed by the Cloud Identity and Access management service. The user needs to authenticate using a user or service account. For security purposes, all messages delivered through PS always stay within the Google network.  

If you have a message that can and has to be transformed before being processed and sent, then PS is the option for you. Imagine that a check on the configuration of your load balancers fails. Then an alert is triggered and a message is sent and published to your PS channel. This makes a Cloud Function trigger too. The function later identifies the problem in the load balancer and sends a command to fix it.

In push subscriptions, PS doesn’t send a negative notice (most commonly known as nack). You can still configure a default notice for push subscriptions. Unlike pull subscriptions, it cannot be extended for individual messages. The deadline of the subscription is effective for the amount of time the endpoint has to respond to the push request.  

When configuring authentication, you must configure two parameters. Service account and Token audience. The service account consists of the GCP account associated to do push subscriptions. The push requests use this account's identity. The Token audience consists of a single string that is used by the Webhook to validate the audience of the token.

In conclusion, Pub/Sub has not been developed to replace Webhook, but to empower the Google Cloud service. Sometimes more is better, and sometimes less sounds more efficient. In this case, one doesn’t take the other away. They both do the same, but they differ in the process. They both alert the user through a notification message, but they differ in the authentication process, in the durability, and in the invocation methods. One is not recommended over the other, though PS is the new and most updated notification method. Google and every company and startup make their best intent in using their time and resources towards working on projects rather than on operational tasks. This service is based on that premise.

TagsGCPMessaging Management ServiceNotification ChannelCloud Monitoring
Lucas Bonder
Technical Writer
Lucas is an Entrepreneur, Web Developer, and Article Writer about Technology.

Related Articles

Back
DevelopersJuly 13, 2020
GCP Introduces Pub/Sub, a Real-Time Messaging Management Service, as a New Notification Channel
Pub/Sub is a new real-time messaging service that lets you send and receive messages between independent applications. Now, it can improve the cloud monitoring experience.

Today we will talk about a new alert system deployed by Google Cloud. Worldwide companies often look at how to make their alerting automatic. This way, companies can focus on their development rather than on operational time taking tasks. Google is one of the companies that has as a priority using their time and human resources in projects.  

Until now there was only one cloud monitoring service that alerted the user. It is called Webhook, the main notification channel. This automation allows the system to respond to errors in the applications. 

Today, Webhook stops being the only notification challenge, and Pub/Sub (PS) is added into the system. This new service is currently in beta mode and it allows the user to create automatic and programmed workflows to respond to alerts.

With PS you can easily set up configurations and alert notifications. This helps developers integrate third-party providers. PS counts with the Google Cloud Console API.  

Webhook                          

If you can use Webhook to integrate third-party packages, why use PS? Well, both methods are valid, and they apply to different situations. They differ in a couple of things, for example, invocation methods (implicit vs explicit), durability, and authentication methods.

Webbooks are used when explicit invocations are required. In these situations, the client retains maximum control over the execution process. The server is responsible for the timing and processing of alert messages.

If the message fails, Webhook tries to deliver the message again multiple times after a failure. If after the multiple requests there is no way to deliver the message, finally the notifications are not delivered.

If you already have a central incident Response Management solution, then webhook fits perfectly. The server uses endpoint URLs. This can be later used by third-party alerting solutions.

After the client invokes the Webhook, the server first receives the request and then parses it and sends the message. If something goes wrong, an incident or “to be resolved” error message is displayed.

The server is responsible for parsing the messages and many third parties send a different JSON payload. They all use one single endpoint. The option to expose separate endpoints for each third party message is also available, yet not very much used. 

What about Webhook's safety? It supports token authentication. You can use basic or token authentication to verify the caller. You as a developer are responsible for maintaining and managing the server. In this scenario, it means making sure the server is always able to receive messages.

What is Pub/Sub?

Contrary to Webhook, PS supports explicit and implicit invocations. explicit being push and implicit being pull requests. When pulling, the person requesting controls when to pull a message and how to process its alert. PS provides a queue where messages wait until they are pulled.

PS has an access-controlled feature, where access is managed by the Cloud Identity and Access management service. The user needs to authenticate using a user or service account. For security purposes, all messages delivered through PS always stay within the Google network.  

If you have a message that can and has to be transformed before being processed and sent, then PS is the option for you. Imagine that a check on the configuration of your load balancers fails. Then an alert is triggered and a message is sent and published to your PS channel. This makes a Cloud Function trigger too. The function later identifies the problem in the load balancer and sends a command to fix it.

In push subscriptions, PS doesn’t send a negative notice (most commonly known as nack). You can still configure a default notice for push subscriptions. Unlike pull subscriptions, it cannot be extended for individual messages. The deadline of the subscription is effective for the amount of time the endpoint has to respond to the push request.  

When configuring authentication, you must configure two parameters. Service account and Token audience. The service account consists of the GCP account associated to do push subscriptions. The push requests use this account's identity. The Token audience consists of a single string that is used by the Webhook to validate the audience of the token.

In conclusion, Pub/Sub has not been developed to replace Webhook, but to empower the Google Cloud service. Sometimes more is better, and sometimes less sounds more efficient. In this case, one doesn’t take the other away. They both do the same, but they differ in the process. They both alert the user through a notification message, but they differ in the authentication process, in the durability, and in the invocation methods. One is not recommended over the other, though PS is the new and most updated notification method. Google and every company and startup make their best intent in using their time and resources towards working on projects rather than on operational tasks. This service is based on that premise.

GCP
Messaging Management Service
Notification Channel
Cloud Monitoring
About the author
Lucas Bonder -Technical Writer
Lucas is an Entrepreneur, Web Developer, and Article Writer about Technology.

Related Articles