mirror of https://github.com/dapr/docs.git
Merge pull request #4136 from hhunter-ms/issue_2923
[Pub/sub] Add match example to API spec
This commit is contained in:
commit
4c7d58e400
|
|
@ -40,7 +40,7 @@ scopes:
|
|||
|
||||
In the programmatic approach, the `routes` structure is returned instead of `route`. The JSON structure matches the declarative YAML:
|
||||
|
||||
{{< tabs Python Node "C#" Go PHP>}}
|
||||
{{< tabs Python JavaScript ".NET" Go PHP>}}
|
||||
|
||||
{{% codetab %}}
|
||||
```python
|
||||
|
|
|
|||
|
|
@ -177,7 +177,15 @@ Example:
|
|||
{
|
||||
"pubsubname": "pubsub",
|
||||
"topic": "newOrder",
|
||||
"route": "/orders",
|
||||
"routes": {
|
||||
"rules": [
|
||||
{
|
||||
"match": "event.type == order",
|
||||
"path": "/orders"
|
||||
}
|
||||
]
|
||||
"default" : "/otherorders"
|
||||
},
|
||||
"metadata": {
|
||||
"rawPayload": "true"
|
||||
}
|
||||
|
|
@ -197,7 +205,7 @@ Parameter | Description
|
|||
|
||||
### Provide route(s) for Dapr to deliver topic events
|
||||
|
||||
In order to deliver topic events, a `POST` call will be made to user code with the route specified in the subscription response.
|
||||
In order to deliver topic events, a `POST` call will be made to user code with the route specified in the subscription response. Under `routes`, you can provide [rules that match a certain condition to a specific path when a message topic is received.]({{< ref "howto-route-messages.md" >}}) You can also provide a default route for any rules that do not have a specific match.
|
||||
|
||||
The following example illustrates this point, considering a subscription for topic `newOrder` with route `orders` on port 3000: `POST http://localhost:3000/orders`
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue