From 2eac805c5e890fbb11a37bcf90e7caa581af4651 Mon Sep 17 00:00:00 2001 From: Shubham Sharma Date: Sat, 16 Sep 2023 03:19:36 +0530 Subject: [PATCH] Add subscriptions to metadata API reference examples (#3682) * Add subscription example to metadata API Signed-off-by: Shubham Sharma * Update metadata API docs Signed-off-by: Shubham Sharma --------- Signed-off-by: Shubham Sharma Co-authored-by: Mark Fussell --- .../content/en/reference/api/metadata_api.md | 69 ++++++++++++++++--- 1 file changed, 59 insertions(+), 10 deletions(-) diff --git a/daprdocs/content/en/reference/api/metadata_api.md b/daprdocs/content/en/reference/api/metadata_api.md index 737e98671..77b568750 100644 --- a/daprdocs/content/en/reference/api/metadata_api.md +++ b/daprdocs/content/en/reference/api/metadata_api.md @@ -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. **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. **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()", + "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()", + "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 + } } } ```