go-sdk/examples/pubsub
Dmitry Shmulevich d9be62fa69
chore - update dependencies (#240)
Signed-off-by: Dmitry Shmulevich <dmitry.shmulevich@gmail.com>
2022-01-20 09:25:39 -08:00
..
config minor reorg of 'examples' folder (#178) 2021-06-24 09:51:01 -07:00
pub replace license headers (#232) 2021-12-14 12:06:12 -08:00
sub Pub/Sub routing support (#227) 2022-01-06 10:19:24 -08:00
README.md Feat: Add Go-sdk Actor Support (#196) 2021-11-02 14:45:27 -07:00
go.mod chore - update dependencies (#240) 2022-01-20 09:25:39 -08:00
go.sum chore - update dependencies (#240) 2022-01-20 09:25:39 -08:00

README.md

Dapr PubSub Example with go-sdk

This folder contains two Go files that use the Go SDK to invoke the Dapr Pub/Sub API.

Diagram

Step

Prepare

  • Dapr installed

Run Subscriber Server

dapr run --app-id sub \
         --app-protocol http \
         --app-port 8080 \
         --dapr-http-port 3500 \
         --log-level debug \
         --components-path ./config \
         go run sub/sub.go

Run Publisher

export DAPR_PUBSUB_NAME=messages

dapr run --app-id pub \
         --log-level debug \
         --components-path ./config \
         go run pub/pub.go

Cleanup

dapr stop --app-id sub
(lsof -i:8080 | grep sub) | awk '{print $2}' | xargs  kill

Result

== APP == 2020/08/23 13:21:58 event - PubsubName: messages, Topic: neworder, ID: 11acaa82-23c4-4244-8969-7360dae52e5d, Data: ping