Merge pull request #4136 from hhunter-ms/issue_2923

[Pub/sub] Add match example to API spec
This commit is contained in:
Hannah Hunter 2024-05-29 19:55:48 -04:00 committed by GitHub
commit 4c7d58e400
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 11 additions and 3 deletions

View File

@ -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

View File

@ -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`