From the course: Google Cloud Platform Essential Training for Developers: Cloud-Native Development with Gemini

Unlock this course with a free trial

Join today to access over 25,500 courses taught by industry experts.

Asynchronous messaging with Pub/Sub

Asynchronous messaging with Pub/Sub

All right, so now what we're going to do is we're going to talk about PubSub. Now, the simplest way I could think of explaining PubSub is, let's say it's Black Friday, and you want to make sure that all your orders are processed timely, and you don't want to get overwhelmed. So let's say you sell the T-shirt. That order is going to hit a topic immediately. And then the subscription acts as the safety cue. So, even if your inventory system gets overwhelmed by thousands and thousands of orders and several shoppers all clicking buy at the same time, the order will wait in its queue, and then your backend will pull and process each sale one by one. And that way, your server doesn't crash and you don't lose a customer. So let's jump in. So the first thing we're going to do in Cloud Shell, we're going to go ahead and set up our environment variables or global variables and let's do this so we're gonna have our topic name dev updates topic and dev update subscription so that's the…

Contents