mirror of https://github.com/dapr/docs.git
Update Multi Pub/Sub How To for consuming topics (#756)
This commit is contained in:
parent
94d2fe90eb
commit
9ea913c7d9
|
@ -51,7 +51,8 @@ const port = 3000
|
|||
res.json([
|
||||
{
|
||||
topic: "newOrder",
|
||||
route: "orders"
|
||||
route: "orders",
|
||||
pubsubName: "messagebus"
|
||||
}
|
||||
]);
|
||||
})</b>
|
||||
|
@ -63,6 +64,8 @@ app.post('/orders', (req, res) => {
|
|||
app.listen(port, () => console.log(`consumer app listening on port ${port}!`))
|
||||
</pre>
|
||||
|
||||
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"
|
||||
}
|
||||
]);
|
||||
})
|
||||
|
|
Loading…
Reference in New Issue