Streaming Data to Cloud Pub/Sub
So far in this chapter you have spent most of your time on moving data into and around Cloud Storage, along with importing and exporting data to databases. Let’s now turn your attention to working with Cloud Pub/Sub, the messaging queue.
As a Cloud Engineer, you may need to create message queues for application developers. Although developers will most likely write services that use Pub/Sub, Cloud Engineers should be able to test Pub/Sub topics and subscriptions. We discussed how to create message queues in Chapter 12. Here our focus will be on creating messages on topics and receiving those messages through subscriptions.
The gcloud pubsub commands you will use are create, publish, and pull. To create a topic, you use the following command:
gcloud pubsub topics create [TOPIC_NAME]
The command to create a subscription is as follows:
gcloud pubsub subscriptions create --topic [TOPIC_NAME] [SUBSCRIPTION_NAME]
For example, to create a topic called ace...





















































