Send messages between services
Messaging lets one part of your app send messages that other parts receive later, so they never have to wait on each other. A new order goes in, and the warehouse picks it up.
Video, 1:08. Storage and data.
Steps
- Overview (0:00)
- A topic (0:14)
- A subscription (0:21)
- Publish (0:32)
- Published (0:39)
- Received (0:43)
- Handled (0:55)
- Try it yourself (1:03)
Transcript
Messaging lets one part of your app send messages that other parts receive later, so they never have to wait on each other. A new order goes in, and the warehouse picks it up.
Under Messaging, create a topic called new-orders. Publishers send messages to it.
Then create a subscription called warehouse, on the new-orders topic. With pull delivery, the warehouse app reads messages when it is ready.
On the topic, publish a message: the details of order 1001.
It is published, with a message ID.
Now, on the warehouse subscription, click Pull. The order arrives, exactly as sent. Acknowledge it, to tell Messaging it has been handled.
Pull again, and the queue is empty. Messages that are not acknowledged are delivered again, so nothing is lost.