Subscription Methods: Unclear/missing information
Describe the issue
The Declarative Subscriptions doc suggests that using the Dapr SDKs requires two steps to be able to subscribe to a Dapr pubsub:
- Component file with
kind: Subscription - Use SDK in the app to act when receiving messages from pubsub
However, I used both Python SDK as well as JS SDK to subscribe to pubsub and it worked fine without step 1. above (i.e. no Yaml file used).
I think it would be great if the following items could be clarified in the docs:
-
Under what circumstances is the yaml file required? (e.g. I assume that I need it if I want to specify
scopes?) -
How is the
routevalue in the yaml file used when leveraging SDKs. Looking at the referenced doc, neither in JS nor in Python code samples, I see a reference to theroute: /checkoutroute from the Yaml example://Subscribe to a topic await server.pubsub.subscribe("pubsub", "orders", async (orderId) => { console.log(`Subscriber received: ${JSON.stringify(orderId)}`) }); await server.startServer();#Subscribe to a topic @app.subscribe(pubsub_name='pubsub', topic='orders') def mytopic(event: v1.Event) -> None: data = json.loads(event.Data()) logging.info('Subscriber received: ' + str(data)) app.run(6002)Further the doc mentions:
The
/checkoutendpoint matches theroutedefined in the subscriptions and this is where Dapr sends all topic messages toBut I can't see the JS/Python apps reference anything related to
/checkout
URL of the docs
https://docs.dapr.io/developing-applications/building-blocks/pubsub/subscription-methods/
Expected content
- Provide context under what circumstances the yaml file (
kind: Subscription) is required. - If SDK + Yaml file are used, please explain the role of
routesetting.
Screenshots
N/A.