Open
Description
Describe the proposal
This proposal is to add a dapr subscribe
command, a counterpart for the existing dapr publish
command. This will be useful in development scenarios which allows users to subscribe to a pubsub/topic/route, and print the data on STDOUT.
Example usage:
# Subscribe to sample topic in target pubsub via subscriber app without cloud event
dapr subscribe --subscribe-app-id myapp --pubsub target --topic sample --metadata '{"rawPayload":"true"}'
# Subscribe to sample topic in target pubsub via subscriber app with custom routes
dapr subscribe --subscribe-app-id myapp --pubsub target --topic sample --routes '{"rules": [{"match": "event.type == \'widget\'", "path": "/widgets"}], "default": "/products"}'
Proposed flags:
Short | Long | Type | Usage |
---|---|---|---|
-m | --metadata | string | The JSON serialized publish metadata (optional) |
-a | --subscribe-app-id | string | The ID of the subscriber app |
-p | --pubsub | string | The name of the pub/sub component |
-t | --topic | string | The topic to be published to |
-r | --routes | string | The JSON serialized routing configuration (optional) |
-u | --unix-domain-socket | string | Path to a unix domain socket dir. If specified, Dapr API servers will use Unix Domain Sockets (optional) |
-o | --output | string | Different levels of output - data (default), time, metadata, all (optional) |
--response | string | Response from the app - success (default), retry, drop (optional) |
Future scope can also include a --filter
option to selectively show data.
Release Note
RELEASE NOTE: ADD Support for dapr subscribe