Serverless Eventing: Google Native with PubSub

Jason Smith Jason Smith

September 17, 2020

Serverless-Eventing-LG-1.png

We have been talking about using an Eventing Bus in this Serverless Eventing series. We have seen examples of using Kafka and NATS as an Eventing Bus. Both are great solutions in their own right but you know my take, there are a ton of tools in the toolbox.

It’s no secret that I work for Google Cloud. I enjoy it because I get to help users explore some great cloud native technology. One really cool offering that fits perfectly into my Serverless Eventing paradigm is Cloud PubSub.

Google Cloud PubSub Logo

What is PubSub?

So what is PubSub? As the name suggests, it is a message bus that utilizes the publish-subscribe pattern. This enables the transmitting of asynchronous messages(events); allowing developers to decouple producing and processing services. Based on the description, this seems perfect for serverless microservices.

PubSub is actually perfect for Serverless Eventing. For one, it is truly serverless. When you sign up to use PubSub, you do not need to provision a minimum or maximum number of brokers nor do you need to consider regions. PubSub abstracts the infrastructure away from the users.

Now there are also cons too. The main one being that it’s proprietary to Google Cloud. There is currently no real way to run it in your own data center. While that could change in the future, it also isn’t OSS. If you have a business or technical requirement for open source software, this will not meet it. However, that’s just fine.

As I have always said, we want to explore all of the options. I will never say that one Eventing Bus is superior to the other. It really depends on your needs, your development culture, and your requirements. The idea of Serverless Eventing is to simplify and improve event driven software, not replace entire systems. Later I may do a large table to show the pros and cons of 4 of 5 different Eventing Busses to give everyone an easy assessment.

Time for the Demo

As always, I will redirect you to my GitHub Repo here. Here you can see my code and a step by step demo that will get you setup and ready to go. I will meet you over there and we’ll head back here.

Conclusion

Now we are back. As you could see, we were able to easily provision a Google PubSub topic , deploy a financial services app using AlphaVantage and their financial API, and consume our real time currency exchange information, all while using the Serverless Eventing model.