quickstarts/pub_sub/python/sdk
Michael Klich 57fc9655cb
Update Python pub_sub fastapi example (#635)
Signed-off-by: Michał Klich <michal@klichx.dev>
2022-05-06 13:05:55 -07:00
..
.vscode create http and sdk directories for each language 2022-02-14 15:57:15 -08:00
checkout change order_pub_sub to orderpubsub (#654) 2022-04-26 16:10:19 -07:00
order-processor Update Python pub_sub fastapi example (#635) 2022-05-06 13:05:55 -07:00
order-processor-fastapi Update Python pub_sub fastapi example (#635) 2022-05-06 13:05:55 -07:00
README.md Update Python pub_sub fastapi example (#635) 2022-05-06 13:05:55 -07:00
makefile add new validaters for new quickstarts - pubsub (#606) 2022-03-16 18:00:33 -07:00

README.md

Dapr pub/sub

In this quickstart, you'll create a publisher microservice and a subscriber microservice to demonstrate how Dapr enables a publish-subcribe pattern. The publisher will generate messages of a specific topic, while subscribers will listen for messages of specific topics. See Why Pub-Sub to understand when this pattern might be a good choice for your software architecture.

Visit this link for more information about Dapr and Pub-Sub.

Note: This example leverages the Dapr client SDK. If you are looking for the example using only HTTP requests click here.

This quickstart includes one publisher:

  • Python client message generator checkout

And one subscriber:

  • Python subscriber order-processor

Run Python message subscriber with Dapr

cd ./order-processor
pip3 install -r requirements.txt 
  1. Run the Python subscriber app with Dapr:
dapr run --app-id order-processor --components-path ../../../components/ --app-port 5001 -- uvicorn app:app --port 5001

Run Python message publisher with Dapr

  1. Install dependencies:
cd ./checkout
pip3 install -r requirements.txt 
  1. Run the Python publisher app with Dapr:
dapr run --app-id checkout --components-path ../../../components/ -- python3 app.py
dapr stop --app-id checkout
dapr stop --app-id order-processor