mirror of https://github.com/dapr/quickstarts.git
2.1 KiB
2.1 KiB
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 generates messages of a specific topic, while subscribers listen for messages of specific topics.
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
requestsclick here.
This quickstart includes one publisher:
- Go client message generator
checkout
And one subscriber:
- Go subscriber
order-processor
Run Go message publisher with Dapr
- Navigate to the directory and install dependencies:
cd ./checkout
go build app.go
- Run the Go publisher app with Dapr:
cd ./checkout
dapr run --app-id checkout --app-protocol http --dapr-http-port 3500 --components-path ../../../components -- go run app.go
Run Go message subscriber with Dapr
- Navigate to the directory and install dependencies:
cd ./order-processor
go build app.go
- Run the Go subscriber app with Dapr:
cd ./order-processor
dapr run --app-port 6001 --app-id order-processor --app-protocol http --dapr-http-port 3501 --components-path ../../../components -- go run app.go
dapr stop --app-id checkout
dapr stop --app-id order-processor