Add subscriptions to metadata API reference examples (#3682)

* Add subscription example to metadata API

Signed-off-by: Shubham Sharma <shubhash@microsoft.com>

* Update metadata API docs

Signed-off-by: Shubham Sharma <shubhash@microsoft.com>

---------

Signed-off-by: Shubham Sharma <shubhash@microsoft.com>
Co-authored-by: Mark Fussell <markfussell@gmail.com>
This commit is contained in:
Shubham Sharma 2023-09-16 03:19:36 +05:30 committed by GitHub
parent 5d3ae81284
commit 2eac805c5e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 59 additions and 10 deletions

View File

@ -75,6 +75,7 @@ Name | Type
---- | ---- | -----------
id | string | Application ID
runtimeVersion | string | Version of the Dapr runtime
enabledFeatures | string[] | List of features enabled by Dapr Configuration, see https://docs.dapr.io/operations/configuration/preview-features/
actors | [Metadata API Response Registered Actor](#metadataapiresponseactor)[] | A json encoded array of registered actors metadata.
extended.attributeName | string | List of custom attributes as key-value pairs, where key is the attribute name.
components | [Metadata API Response Component](#metadataapiresponsecomponent)[] | A json encoded array of loaded components metadata.
@ -111,14 +112,14 @@ Name | Type | Description
pubsubname | string | Name of the pub/sub.
topic | string | Topic name.
metadata | object | Metadata associated with the subscription.
rules | [Metadata API Response Subscription Rules](metadataapiresponsesubscriptionrules)[] | List of rules associated with the subscription.
rules | [Metadata API Response Subscription Rules](#metadataapiresponsesubscriptionrules)[] | List of rules associated with the subscription.
deadLetterTopic | string | Dead letter topic name.
<a id="metadataapiresponsesubscriptionrules"></a>**Metadata API Response Subscription Rules**
Name | Type | Description
---- | ---- | -----------
match | string | CEL expression to match the message.
match | string | CEL expression to match the message, see https://docs.dapr.io/developing-applications/building-blocks/pubsub/howto-route-messages/#common-expression-language-cel
path | string | Path to route the message if the match expression is true.
<a id="metadataapiresponseappconnectionproperties"></a>**Metadata API Response AppConnectionProperties**
@ -143,15 +144,13 @@ healthThreshold | integer | Max number of failed health probes before the app is
### Examples
Note: This example is based on the Actor sample provided in the [Dapr SDK for Python](https://github.com/dapr/python-sdk/tree/master/examples/demo_actor).
```shell
curl http://localhost:3500/v1.0/metadata
```
```json
{
"id": "demo-actor",
"id": "myApp",
"runtimeVersion": "1.12.0",
"enabledFeatures": [
"ServiceInvocationStreaming"
@ -178,6 +177,27 @@ curl http://localhost:3500/v1.0/metadata
]
}
],
"httpEndpoints": [
{
"name": "my-backend-api"
}
],
"subscriptions": [
{
"pubsubname": "pubsub",
"topic": "orders",
"deadLetterTopic": "",
"metadata": {
"ttlInSeconds": "30"
},
"rules": [
{
"match": "%!s(<nil>)",
"path": "orders"
}
]
}
],
"extended": {
"appCommand": "uvicorn --port 3000 demo_actor_service:app",
"appPID": "98121",
@ -187,7 +207,12 @@ curl http://localhost:3500/v1.0/metadata
"appConnectionProperties": {
"port": 3000,
"protocol": "http",
"channelAddress": "127.0.0.1"
"channelAddress": "127.0.0.1",
"health": {
"healthProbeInterval": "5s",
"healthProbeTimeout": "500ms",
"healthThreshold": 3
}
}
}
```
@ -236,8 +261,6 @@ Code | Description
### Examples
Note: This example is based on the Actor sample provided in the [Dapr SDK for Python](https://github.com/dapr/python-sdk/tree/master/examples/demo_actor).
Add a custom attribute to the metadata endpoint:
```shell
@ -248,7 +271,7 @@ Get the metadata information to confirm your custom attribute was added:
```json
{
"id": "demo-actor",
"id": "myApp",
"runtimeVersion": "1.12.0",
"enabledFeatures": [
"ServiceInvocationStreaming"
@ -275,6 +298,27 @@ Get the metadata information to confirm your custom attribute was added:
]
}
],
"httpEndpoints": [
{
"name": "my-backend-api"
}
],
"subscriptions": [
{
"pubsubname": "pubsub",
"topic": "orders",
"deadLetterTopic": "",
"metadata": {
"ttlInSeconds": "30"
},
"rules": [
{
"match": "%!s(<nil>)",
"path": "orders"
}
]
}
],
"extended": {
"myDemoAttribute": "myDemoAttributeValue",
"appCommand": "uvicorn --port 3000 demo_actor_service:app",
@ -285,7 +329,12 @@ Get the metadata information to confirm your custom attribute was added:
"appConnectionProperties": {
"port": 3000,
"protocol": "http",
"channelAddress": "127.0.0.1"
"channelAddress": "127.0.0.1",
"health": {
"healthProbeInterval": "5s",
"healthProbeTimeout": "500ms",
"healthThreshold": 3
}
}
}
```