Changes based on the review comments

Signed-off-by: Amulya Varote <amulyavarote@microsoft.com>
This commit is contained in:
Amulya Varote 2022-03-30 15:29:11 -07:00
parent 1eee51b153
commit 2abc6896f3
1 changed files with 6 additions and 12 deletions

View File

@ -227,24 +227,18 @@ async def executeConfiguration():
with DaprClient() as d: with DaprClient() as d:
CONFIG_STORE_NAME = 'configstore' CONFIG_STORE_NAME = 'configstore'
key = 'orderId' key = 'orderId'
# Wait for sidecar to be up within 20 seconds.
d.wait(20)
# Subscribe to configuration by key. # Subscribe to configuration by key.
configuration = await d.subscribe_configuration(store_name=CONFIG_STORE_NAME, keys=[key], config_metadata={}) configuration = await d.subscribe_configuration(store_name=CONFIG_STORE_NAME, keys=[key], config_metadata={})
for x in range(10): if configuration != None:
if configuration != None: items = configuration.get_items()
items = configuration.get_items() for item in items:
for item in items: print(f"Subscribe key={item.key} value={item.value} version={item.version}", flush=True)
print(f"Subscribe key={item.key} value={item.value} version={item.version}", flush=True) else:
else: print("Nothing yet")
print("Nothing yet")
sleep(5)
asyncio.run(executeConfiguration()) asyncio.run(executeConfiguration())
``` ```
Navigate to the directory containing the above code and run the following command to launch the application along with a Dapr sidecar:
```bash ```bash
dapr run --app-id orderprocessing --components-path components/ -- python3 OrderProcessingService.py dapr run --app-id orderprocessing --components-path components/ -- python3 OrderProcessingService.py
``` ```