Google Cloud Pub/Sub: Qwik Start - Command Line
Set Project ID 設定 Project ID
1 | gcloud config set project qwiklabs-gcp-5c43d7b7f27776fe |
Topics
Create Pub/Sub Topics 建立主題
1 | gcloud pubsub topics create myTopic |
Delete Topics 刪除主題
1 | gcloud pubsub topics delete Test1 |
Subscriptions
Create Subscriptions 建立訂閱
1 | gcloud pubsub subscriptions create --topic myTopic mySubscription |
Delete Subscription 刪除主題
1 | gcloud pubsub subscriptions delete mySubscription |
Autoack
1 | gcloud pubsub subscriptions pull mySubscription --auto-ack |
Publish
Publish message 加入 Message 至 Topic
1 | gcloud pubsub topics publish myTopic --message "Hello" |
Pull
Pull Message
1 | gcloud pubsub subscriptions pull mySubscription --auto-ack --limit=3 |
–limit=3 取得前三個