0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

【GCP】pub/sub使ってみた

0
Last updated at Posted at 2020-09-10

チュートリアルがあるので、まずはそれのとおりに以下のコマンドを打つ。

149 gcloud pubsub topics create my-topic
150 gcloud pubsub subscriptions create my-sub --topic my-topic --ack-deadline=60
151 gcloud pubsub topics list
152 gcloud pubsub subscriptions list
153 gcloud pubsub topics publish my-topic --message hello
154 gcloud pubsub topics publish my-topic --message goodbye
155 gcloud pubsub subscriptions pull --auto-ack --limit=2 my-sub

チュートリアルにもあるが、pullしたメッセージがちゃんと表示されない場合もある。

156 gcloud pubsub subscriptions pull my-sub
157 gcloud pubsub topics publish my-topic --message thanks
158 gcloud pubsub subscriptions pull my-sub
159 gcloud pubsub subscriptions ack my-sub --ack-ids ACK_ID

ここのACK_IDは 158 で表示されたもののACK_IDを記載する。すごく長いので注意。

以下のサイトの図をみるとイメージしやすい
https://cloud.google.com/pubsub/docs/overview?hl=ja
DSC_0536.JPG

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?