From 9ea913c7d9c57a3bb73ffd86a8812d16c63ee398 Mon Sep 17 00:00:00 2001 From: Yaron Schneider Date: Wed, 19 Aug 2020 10:32:35 -0700 Subject: [PATCH] Update Multi Pub/Sub How To for consuming topics (#756) --- howto/consume-topic/README.md | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/howto/consume-topic/README.md b/howto/consume-topic/README.md index 6136f196b..da146836c 100644 --- a/howto/consume-topic/README.md +++ b/howto/consume-topic/README.md @@ -51,7 +51,8 @@ const port = 3000 res.json([ { topic: "newOrder", - route: "orders" + route: "orders", + pubsubName: "messagebus" } ]); }) @@ -63,6 +64,8 @@ app.post('/orders', (req, res) => { app.listen(port, () => console.log(`consumer app listening on port ${port}!`)) +In the payload returned to Dapr, `topic` tells Dapr which topic to subscribe to, `route` tells Dapr which endpoint to call on when a message comes to that topic, and `pubsubName` tells Dapr which pub/sub component it should use. In this example this is `messagebus` as this is the name of the component we outlined above. + ## Consume messages To consume messages from a topic, start a web server in the programming language of your choice and listen on a `POST` endpoint with the route path you specified when subscribing. @@ -74,7 +77,8 @@ app.get('/dapr/subscribe', (req, res) => { res.json([ { topic: "onCreated", - route: "custom/path" + route: "custom/path", + pubsubName: "messagebus" } ]); })