Fixes some Go samples (#782)

* Fixes service invocation Go samples

Signed-off-by: ItalyPaleAle <43508+ItalyPaleAle@users.noreply.github.com>

* Fixes + updates to the pubsub sdk apps too

Signed-off-by: ItalyPaleAle <43508+ItalyPaleAle@users.noreply.github.com>

* More updates

Signed-off-by: ItalyPaleAle <43508+ItalyPaleAle@users.noreply.github.com>

---------

Signed-off-by: ItalyPaleAle <43508+ItalyPaleAle@users.noreply.github.com>
This commit is contained in:
Alessandro (Ale) Segala 2023-02-02 16:31:32 -08:00 committed by GitHub
parent 332ac444a4
commit b91d817ca5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
44 changed files with 352 additions and 359 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -1,34 +1,18 @@
# Dapr pub/sub # Dapr pub/sub
In this quickstart, you'll create a publisher microservice and a subscriber microservice to demonstrate how Dapr enables a publish-subcribe API. The publisher generates messages for a specific topic, while subscribers listen for messages on specific topics. 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 for a specific topic, while the subscriber listen for messages in specific topics.
Visit [this](https://docs.dapr.io/developing-applications/building-blocks/pubsub/) link for more information about Dapr and Pub-Sub. Check out the documentation about [Dapr pubsub](https://docs.dapr.io/developing-applications/building-blocks/pubsub/) for more details.
> **Note:** This example leverages HTTP `requests` only. If you are looking for the example using the Dapr Client SDK (recommended) [click here](../sdk/). > **Note:** This example leverages HTTP `requests` only. You can find an example of using the Dapr Client SDK (recommended) in the [`sdk` folder](../sdk/).
This quickstart includes one publisher: This quickstart includes one publisher: Go client message generator `checkout`.
- Go client message generator `checkout` And one subscriber: Go subscriber `order-processor`.
And one subscriber:
- Go subscriber `order-processor`
### Run Go message subscriber with Dapr ### Run Go message subscriber with Dapr
1. Navigate to the directory and install dependencies: 1. Run the Go subscriber app with Dapr in the `order-processor` folder:
<!-- STEP
name: Build Go file
-->
```bash
cd ./order-processor
go build .
```
<!-- END_STEP -->
2. Run the Go subscriber app with Dapr:
<!-- STEP <!-- STEP
name: Run Go subscriber name: Run Go subscriber
@ -41,28 +25,22 @@ background: true
sleep: 15 sleep: 15
--> -->
```bash ```bash
cd ./order-processor cd ./order-processor
dapr run --app-port 6001 --app-id order-processor --app-protocol http --dapr-http-port 3501 --components-path ../../../components -- go run . dapr run \
--app-port 6001 \
--app-id order-processor \
--app-protocol http \
--dapr-http-port 3501 \
--components-path ../../../components \
-- go run .
``` ```
<!-- END_STEP --> <!-- END_STEP -->
### Run Go message publisher with Dapr ### Run Go message publisher with Dapr
1. Navigate to the directory and install dependencies: 1. Run the Go publisher app with Dapr in the `checkout` folder:
<!-- STEP
name: Build Go file
-->
```bash
cd ./checkout
go build .
```
<!-- END_STEP -->
2. Run the Go publisher app with Dapr:
<!-- STEP <!-- STEP
name: Run Go publisher name: Run Go publisher
@ -78,11 +56,17 @@ sleep: 15
```bash ```bash
cd ./checkout cd ./checkout
dapr run --app-id checkout-http --app-protocol http --dapr-http-port 3500 --components-path ../../../components -- go run . dapr run \
--app-id checkout-http \
--dapr-http-port 3500 \
--components-path ../../../components \
-- go run .
``` ```
<!-- END_STEP --> <!-- END_STEP -->
To stop:
```bash ```bash
dapr stop --app-id checkout-http dapr stop --app-id checkout-http
dapr stop --app-id order-processor dapr stop --app-id order-processor

View File

@ -10,33 +10,38 @@ import (
"time" "time"
) )
const PUBSUB_NAME = "orderpubsub" const pubsubComponentName = "orderpubsub"
const PUBSUB_TOPIC = "orders" const pubsubTopic = "orders"
func main() { func main() {
daprHost := "http://localhost" daprHost := os.Getenv("DAPR_HOST")
if value, ok := os.LookupEnv("DAPR_HOST"); ok { if daprHost == "" {
daprHost = value daprHost = "http://localhost"
} }
daprHttpPost := "3500" daprHttpPort := os.Getenv("DAPR_HTTP_PORT")
if value, ok := os.LookupEnv("DAPR_HTTP_PORT"); ok { if daprHttpPort == "" {
daprHttpPost = value daprHttpPort = "3500"
} }
client := http.Client{
Timeout: 15 * time.Second,
}
for i := 1; i <= 10; i++ { for i := 1; i <= 10; i++ {
order := `{"orderId":` + strconv.Itoa(i) + `}` order := `{"orderId":` + strconv.Itoa(i) + `}`
client := http.Client{} req, err := http.NewRequest("POST", daprHost+":"+daprHttpPort+"/v1.0/publish/"+pubsubComponentName+"/"+pubsubTopic, strings.NewReader(order))
req, err := http.NewRequest("POST", daprHost+":"+daprHttpPost+"/v1.0/publish/"+PUBSUB_NAME+"/"+PUBSUB_TOPIC, strings.NewReader(order))
if err != nil { if err != nil {
log.Fatal(err.Error()) log.Fatal(err.Error())
os.Exit(1)
} }
// Publish an event using Dapr pub/sub // Publish an event using Dapr pub/sub
if _, err = client.Do(req); err != nil { res, err := client.Do(req)
if err != nil {
log.Fatal(err) log.Fatal(err)
} }
defer res.Body.Close()
fmt.Println("Published data: ", order) fmt.Println("Published data:", order)
time.Sleep(1000) time.Sleep(1000)
} }

View File

@ -1,3 +1,3 @@
module dapr_example module checkout_example
go 1.18 go 1.19

View File

@ -31,11 +31,11 @@ func getOrder(w http.ResponseWriter, r *http.Request) {
} }
jsonBytes, err := json.Marshal(jsonData) jsonBytes, err := json.Marshal(jsonData)
if err != nil { if err != nil {
log.Fatal("Error in reading the result obj") log.Fatal(err.Error())
} }
_, err = w.Write(jsonBytes) _, err = w.Write(jsonBytes)
if err != nil { if err != nil {
log.Fatal("Error in writing the result obj") log.Fatal(err.Error())
} }
} }
@ -47,33 +47,36 @@ func postOrder(w http.ResponseWriter, r *http.Request) {
var result Result var result Result
err = json.Unmarshal(data, &result) err = json.Unmarshal(data, &result)
if err != nil { if err != nil {
log.Fatal(err) log.Fatal(err.Error())
} }
fmt.Println("Subscriber received: ", string(result.Data)) fmt.Println("Subscriber received:", string(result.Data))
obj, err := json.Marshal(data) obj, err := json.Marshal(data)
if err != nil { if err != nil {
log.Fatal("Error in reading the result obj") log.Fatal(err.Error())
} }
_, err = w.Write(obj) _, err = w.Write(obj)
if err != nil { if err != nil {
log.Fatal("Error in writing the result obj") log.Fatal(err.Error())
} }
} }
func main() { func main() {
appPort := "6001" appPort := os.Getenv("APP_PORT")
if value, ok := os.LookupEnv("APP_PORT"); ok { if appPort == "" {
appPort = value appPort = "6001"
} }
r := mux.NewRouter() r := mux.NewRouter()
// Handle the /dapr/subscribe route which Dapr invokes to get the list of subscribed endpoints
r.HandleFunc("/dapr/subscribe", getOrder).Methods("GET") r.HandleFunc("/dapr/subscribe", getOrder).Methods("GET")
// Dapr subscription routes orders topic to this route // Dapr subscription routes orders topic to this route
r.HandleFunc("/orders", postOrder).Methods("POST") r.HandleFunc("/orders", postOrder).Methods("POST")
if err := http.ListenAndServe(":"+appPort, r); err != nil { // Start the server; this is a blocking call
err := http.ListenAndServe(":"+appPort, r)
if err != http.ErrServerClosed {
log.Panic(err) log.Panic(err)
} }
} }

View File

@ -1,5 +1,5 @@
module dapr_example module order_processor_example
go 1.18 go 1.19
require github.com/gorilla/mux v1.8.0 require github.com/gorilla/mux v1.8.0

View File

@ -1,34 +1,18 @@
# Dapr pub/sub # 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. 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 for a specific topic, while the subscriber listen for messages in specific topics.
Visit [this](https://docs.dapr.io/developing-applications/building-blocks/pubsub/) link for more information about Dapr and Pub-Sub. Check out the documentation about [Dapr pubsub](https://docs.dapr.io/developing-applications/building-blocks/pubsub/) for more details.
> **Note:** This example leverages the Dapr client SDK. If you are looking for the example using only HTTP `requests` [click here](../http). > **Note:** This example leverages the Dapr Client SDK. You can find an example using plain HTTP in the [`http` folder](../http/).
This quickstart includes one publisher: This quickstart includes one publisher: Go client message generator `checkout`
- Go client message generator `checkout` And one subscriber: Go subscriber `order-processor`
And one subscriber:
- Go subscriber `order-processor`
### Run Go message subscriber with Dapr ### Run Go message subscriber with Dapr
1. Navigate to the directory and install dependencies: 1. Run the Go subscriber app with Dapr in the `order-processor` folder:
<!-- STEP
name: Build Go file
-->
```bash
cd ./order-processor
go build .
```
<!-- END_STEP -->
2. Run the Go subscriber app with Dapr:
<!-- STEP <!-- STEP
name: Run Go subscriber name: Run Go subscriber
@ -43,25 +27,20 @@ sleep: 15
```bash ```bash
cd ./order-processor cd ./order-processor
dapr run --app-port 6002 --app-id order-processor-sdk --app-protocol http --dapr-http-port 3501 --components-path ../../../components -- go run . dapr run \
--app-port 6002 \
--app-id order-processor-sdk \
--app-protocol http \
--dapr-http-port 3501 \
--components-path ../../../components \
-- go run .
``` ```
<!-- END_STEP --> <!-- END_STEP -->
### Run Go message publisher with Dapr ### Run Go message publisher with Dapr
1. Navigate to the directory and install dependencies: 1 Run the Go publisher app with Dapr in the `checkout` folder:
<!-- STEP
name: Build Go file
-->
```bash
cd ./checkout
go build .
```
<!-- END_STEP -->
2. Run the Go publisher app with Dapr:
<!-- STEP <!-- STEP
name: Run Go publisher name: Run Go publisher
@ -77,11 +56,17 @@ sleep: 15
```bash ```bash
cd ./checkout cd ./checkout
dapr run --app-id checkout-sdk --app-protocol http --dapr-http-port 3500 --components-path ../../../components -- go run . dapr run \
--app-id checkout-sdk \
--dapr-http-port 3500 \
--components-path ../../../components \
-- go run .
``` ```
<!-- END_STEP --> <!-- END_STEP -->
To stop:
```bash ```bash
dapr stop --app-id checkout-sdk dapr stop --app-id checkout-sdk
dapr stop --app-id order-processor-sdk dapr stop --app-id order-processor-sdk

View File

@ -9,27 +9,29 @@ import (
dapr "github.com/dapr/go-sdk/client" dapr "github.com/dapr/go-sdk/client"
) )
var ( const (
PUBSUB_NAME = "orderpubsub" pubsubComponentName = "orderpubsub"
PUBSUB_TOPIC = "orders" pubsubTopic = "orders"
) )
func main() { func main() {
// Create a new client for Dapr using the SDK
client, err := dapr.NewClient() client, err := dapr.NewClient()
if err != nil { if err != nil {
panic(err) panic(err)
} }
defer client.Close() defer client.Close()
ctx := context.Background()
// Publish events using Dapr pubsub
for i := 1; i <= 10; i++ { for i := 1; i <= 10; i++ {
order := `{"orderId":` + strconv.Itoa(i) + `}` order := `{"orderId":` + strconv.Itoa(i) + `}`
// Publish an event using Dapr pub/sub err := client.PublishEvent(context.Background(), pubsubComponentName, pubsubTopic, []byte(order))
if err := client.PublishEvent(ctx, PUBSUB_NAME, PUBSUB_TOPIC, []byte(order)); err != nil { if err != nil {
panic(err) panic(err)
} }
fmt.Println("Published data: ", order) fmt.Println("Published data:", order)
time.Sleep(1000) time.Sleep(1000)
} }

Binary file not shown.

View File

@ -1,11 +1,10 @@
module dapr_example module checkout_sdk_example
go 1.18 go 1.19
require github.com/dapr/go-sdk v1.5.0 require github.com/dapr/go-sdk v1.6.0
require ( require (
github.com/dapr/dapr v1.8.0 // indirect
github.com/golang/protobuf v1.5.2 // indirect github.com/golang/protobuf v1.5.2 // indirect
github.com/pkg/errors v0.9.1 // indirect github.com/pkg/errors v0.9.1 // indirect
golang.org/x/net v0.0.0-20220621193019-9d032be2e588 // indirect golang.org/x/net v0.0.0-20220621193019-9d032be2e588 // indirect

View File

@ -11,10 +11,8 @@ github.com/cncf/udpa/go v0.0.0-20210930031921-04548b0d99d4/go.mod h1:6pvJx4me5XP
github.com/cncf/xds/go v0.0.0-20210922020428-25de7278fc84/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= github.com/cncf/xds/go v0.0.0-20210922020428-25de7278fc84/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs=
github.com/cncf/xds/go v0.0.0-20211001041855-01bcc9b48dfe/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= github.com/cncf/xds/go v0.0.0-20211001041855-01bcc9b48dfe/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs=
github.com/cncf/xds/go v0.0.0-20211011173535-cb28da3451f1/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= github.com/cncf/xds/go v0.0.0-20211011173535-cb28da3451f1/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs=
github.com/dapr/dapr v1.8.0 h1:ZAAoBe6wuFp7k4tIHB7ajZXVTtGeDeVqIPrldzo3dF0= github.com/dapr/go-sdk v1.6.0 h1:jg5A2khSCHF8bGZsig5RWN/gD0jjitszc2V6Uq2pPdY=
github.com/dapr/dapr v1.8.0/go.mod h1:yAsDiK5oecG0htw2S8JG9RFaeHJVdlTfZyOrL57AvRM= github.com/dapr/go-sdk v1.6.0/go.mod h1:KLQBltoD9K0w5hKTihdcyg9Epob9gypwL5dYcQzPro4=
github.com/dapr/go-sdk v1.5.0 h1:OVkrupquJEOL1qRtwKcMVrFKYhw4UJQvgOJNduo2VxE=
github.com/dapr/go-sdk v1.5.0/go.mod h1:Cvz3taCVu22WCNEUbc9/szvG/yJxWPAV4dcaG+zDWA4=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4=
@ -51,6 +49,8 @@ github.com/google/go-cmp v0.5.8 h1:e6P7q2lk1O+qJJb4BtCQXlK8vWEO8V1ZeuEdJNOqZyg=
github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I= github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I=
github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw= github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw=
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e h1:fD57ERR4JtEqsWbfPhv4DMiApHyliiK5xCTNVSPiaAs=
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
@ -140,8 +140,8 @@ google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQ
google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
google.golang.org/protobuf v1.28.0 h1:w43yiav+6bVFTBQFZX0r7ipe9JQ1QsbMgHwbBziscLw= google.golang.org/protobuf v1.28.0 h1:w43yiav+6bVFTBQFZX0r7ipe9JQ1QsbMgHwbBziscLw=
google.golang.org/protobuf v1.28.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= google.golang.org/protobuf v1.28.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f h1:BLraFXnmrev5lT+xlilqcH8XK9/i0At2xKjWk4p6zsU=
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.2.3/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.3/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=

View File

@ -18,21 +18,26 @@ var sub = &common.Subscription{
} }
func main() { func main() {
appPort := "6002" appPort := os.Getenv("APP_PORT")
if value, ok := os.LookupEnv("APP_PORT"); ok { if appPort == "" {
appPort = value appPort = "6002"
} }
// Create the new server on appPort and add a topic listener
s := daprd.NewService(":" + appPort) s := daprd.NewService(":" + appPort)
if err := s.AddTopicEventHandler(sub, eventHandler); err != nil { err := s.AddTopicEventHandler(sub, eventHandler)
if err != nil {
log.Fatalf("error adding topic subscription: %v", err) log.Fatalf("error adding topic subscription: %v", err)
} }
if err := s.Start(); err != nil && err != http.ErrServerClosed {
// Start the server
err = s.Start()
if err != nil && err != http.ErrServerClosed {
log.Fatalf("error listenning: %v", err) log.Fatalf("error listenning: %v", err)
} }
} }
func eventHandler(ctx context.Context, e *common.TopicEvent) (retry bool, err error) { func eventHandler(ctx context.Context, e *common.TopicEvent) (retry bool, err error) {
fmt.Println("Subscriber received: ", e.Data) fmt.Println("Subscriber received:", e.Data)
return false, nil return false, nil
} }

View File

@ -1,11 +1,10 @@
module dapr_example module order_processor_sdk_example
go 1.18 go 1.19
require github.com/dapr/go-sdk v1.5.0 require github.com/dapr/go-sdk v1.6.0
require ( require (
github.com/dapr/dapr v1.8.0 // indirect
github.com/golang/protobuf v1.5.2 // indirect github.com/golang/protobuf v1.5.2 // indirect
github.com/gorilla/mux v1.8.0 // indirect github.com/gorilla/mux v1.8.0 // indirect
github.com/pkg/errors v0.9.1 // indirect github.com/pkg/errors v0.9.1 // indirect

View File

@ -11,10 +11,8 @@ github.com/cncf/udpa/go v0.0.0-20210930031921-04548b0d99d4/go.mod h1:6pvJx4me5XP
github.com/cncf/xds/go v0.0.0-20210922020428-25de7278fc84/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= github.com/cncf/xds/go v0.0.0-20210922020428-25de7278fc84/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs=
github.com/cncf/xds/go v0.0.0-20211001041855-01bcc9b48dfe/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= github.com/cncf/xds/go v0.0.0-20211001041855-01bcc9b48dfe/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs=
github.com/cncf/xds/go v0.0.0-20211011173535-cb28da3451f1/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= github.com/cncf/xds/go v0.0.0-20211011173535-cb28da3451f1/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs=
github.com/dapr/dapr v1.8.0 h1:ZAAoBe6wuFp7k4tIHB7ajZXVTtGeDeVqIPrldzo3dF0= github.com/dapr/go-sdk v1.6.0 h1:jg5A2khSCHF8bGZsig5RWN/gD0jjitszc2V6Uq2pPdY=
github.com/dapr/dapr v1.8.0/go.mod h1:yAsDiK5oecG0htw2S8JG9RFaeHJVdlTfZyOrL57AvRM= github.com/dapr/go-sdk v1.6.0/go.mod h1:KLQBltoD9K0w5hKTihdcyg9Epob9gypwL5dYcQzPro4=
github.com/dapr/go-sdk v1.5.0 h1:OVkrupquJEOL1qRtwKcMVrFKYhw4UJQvgOJNduo2VxE=
github.com/dapr/go-sdk v1.5.0/go.mod h1:Cvz3taCVu22WCNEUbc9/szvG/yJxWPAV4dcaG+zDWA4=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4=
@ -54,6 +52,8 @@ github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I=
github.com/gorilla/mux v1.8.0 h1:i40aqfkR1h2SlN9hojwV5ZA91wcXFOvkdNIeFDP5koI= github.com/gorilla/mux v1.8.0 h1:i40aqfkR1h2SlN9hojwV5ZA91wcXFOvkdNIeFDP5koI=
github.com/gorilla/mux v1.8.0/go.mod h1:DVbg23sWSpFRCP0SfiEN6jmj59UnW/n46BH5rLB71So= github.com/gorilla/mux v1.8.0/go.mod h1:DVbg23sWSpFRCP0SfiEN6jmj59UnW/n46BH5rLB71So=
github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw= github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw=
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e h1:fD57ERR4JtEqsWbfPhv4DMiApHyliiK5xCTNVSPiaAs=
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
@ -143,8 +143,8 @@ google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQ
google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
google.golang.org/protobuf v1.28.0 h1:w43yiav+6bVFTBQFZX0r7ipe9JQ1QsbMgHwbBziscLw= google.golang.org/protobuf v1.28.0 h1:w43yiav+6bVFTBQFZX0r7ipe9JQ1QsbMgHwbBziscLw=
google.golang.org/protobuf v1.28.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= google.golang.org/protobuf v1.28.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f h1:BLraFXnmrev5lT+xlilqcH8XK9/i0At2xKjWk4p6zsU=
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.2.3/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.3/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=

View File

@ -5,5 +5,6 @@ Dapr provides a capability for defining and applying fault tolerance resiliency
In this Quickstart, you will observe Dapr resiliency capabilities by simulating a system failure. You have the option of using the service invocation quickstarts to demonstrate Dapr resiliency between service-to-service communication, or the state management quickstart to demonstrate resiliency between apps and components. In this Quickstart, you will observe Dapr resiliency capabilities by simulating a system failure. You have the option of using the service invocation quickstarts to demonstrate Dapr resiliency between service-to-service communication, or the state management quickstart to demonstrate resiliency between apps and components.
### Select resiliency quickstart ### Select resiliency quickstart
- For service-to-service resiliency, see [here](./service-to-service-resiliency.md) - For service-to-service resiliency, see [here](./service-to-service-resiliency.md)
- For service to component resiliency, see [here](./service-to-component-resiliency.md) - For service-to-component resiliency, see [here](./service-to-component-resiliency.md)

View File

@ -2,7 +2,7 @@
In this QuickStart, you will run a microservice application that continuously persists and retrieves state via Dapr's state management API. When operations to the state store begin to fail, Dapr resiliency policies are applied. In this QuickStart, you will run a microservice application that continuously persists and retrieves state via Dapr's state management API. When operations to the state store begin to fail, Dapr resiliency policies are applied.
Visit [this](https://docs.dapr.io/operations/resiliency/resiliency-overview//) link for more information about Dapr resiliency. Visit the documentation about [Dapr resiliency](https://docs.dapr.io/operations/resiliency/resiliency-overview/) link for more information
This quickstart includes one service: This quickstart includes one service:
@ -14,7 +14,8 @@ This quickstart includes one service:
1. Navigate to the app directory, install dependencies, and run the service with resiliency enabled via the config.yaml: 1. Navigate to the app directory, install dependencies, and run the service with resiliency enabled via the config.yaml:
### CSharp example: ### C# example:
```bash ```bash
cd ../state_management/csharp/sdk/order-processor cd ../state_management/csharp/sdk/order-processor
dotnet restore dotnet restore
@ -23,6 +24,7 @@ dapr run --app-id order-processor --config ../config.yaml --components-path ../.
``` ```
### Go example: ### Go example:
```bash ```bash
cd ../state_management/go/sdk/order-processor cd ../state_management/go/sdk/order-processor
go build . go build .
@ -30,6 +32,7 @@ dapr run --app-id order-processor --config ../config.yaml --components-path ../.
``` ```
### Java example: ### Java example:
```bash ```bash
cd ../state_management/java/sdk/order-processor cd ../state_management/java/sdk/order-processor
mvn clean install mvn clean install
@ -37,6 +40,7 @@ dapr run --app-id order-processor --config ../config.yaml --components-path ../.
``` ```
### JavaScript example: ### JavaScript example:
```bash ```bash
cd ../state_management/javascript/sdk/order-processor cd ../state_management/javascript/sdk/order-processor
npm install npm install
@ -44,6 +48,7 @@ dapr run --app-id order-processor ../config.yaml --components-path ../../../comp
``` ```
### Python example: ### Python example:
```bash ```bash
cd ../state_management/python/sdk/order-processor cd ../state_management/python/sdk/order-processor
pip3 install -r requirements.txt pip3 install -r requirements.txt
@ -51,6 +56,7 @@ dapr run --app-id order-processor ../config.yaml --components-path ../../../comp
``` ```
### Expected output: ### Expected output:
```bash ```bash
== APP == Saving Order: { orderId: '1' } == APP == Saving Order: { orderId: '1' }
== APP == Getting Order: { orderId: '1' } == APP == Getting Order: { orderId: '1' }
@ -64,6 +70,7 @@ dapr run --app-id order-processor ../config.yaml --components-path ../../../comp
<!-- END_STEP --> <!-- END_STEP -->
### Simulate a component failure by stopping the Redis container instance ### Simulate a component failure by stopping the Redis container instance
In a new terminal window, stop the Redis container that's running on your machine: In a new terminal window, stop the Redis container that's running on your machine:
```bash ```bash
@ -73,6 +80,7 @@ docker stop dapr_redis
### Observe retry and circuit breaker policies are applied: ### Observe retry and circuit breaker policies are applied:
Policies defined in the resiliency.yaml spec: Policies defined in the resiliency.yaml spec:
```yaml ```yaml
retryForever: retryForever:
policy: constant policy: constant
@ -87,6 +95,7 @@ circuitBreakers:
``` ```
Applied policies: Applied policies:
```bash ```bash
INFO[0006] Error processing operation component[statestore] output. Retrying... INFO[0006] Error processing operation component[statestore] output. Retrying...
INFO[0026] Circuit breaker "simpleCB-statestore" changed state from closed to open INFO[0026] Circuit breaker "simpleCB-statestore" changed state from closed to open
@ -100,7 +109,7 @@ INFO[0031] Circuit breaker "simpleCB-statestore" changed state from half-open to
docker start dapr_redis docker start dapr_redis
``` ```
### Observe orders have resumed sequentially: ### Observe orders have resumed sequentially
```bash ```bash
INFO[0036] Recovered processing operation component[statestore] output. INFO[0036] Recovered processing operation component[statestore] output.
@ -117,6 +126,7 @@ INFO[0036] Recovered processing operation component[statestore] output.
``` ```
### Stop the app with Dapr ### Stop the app with Dapr
```bash ```bash
dapr stop --app-id order-processor dapr stop --app-id order-processor
``` ```

View File

@ -2,7 +2,7 @@
In this QuickStart, you will run two microservice applications. One microservice (`checkout`) will continuously make Dapr service invocation requests to the other microservice (`order-processor`). When requests begin to fail, Dapr resiliency policies are applied. In this QuickStart, you will run two microservice applications. One microservice (`checkout`) will continuously make Dapr service invocation requests to the other microservice (`order-processor`). When requests begin to fail, Dapr resiliency policies are applied.
Visit [this](https://docs.dapr.io/operations/resiliency/resiliency-overview//) link for more information about Dapr resiliency. Visit the documentation about [Dapr resiliency](https://docs.dapr.io/operations/resiliency/resiliency-overview/) link for more information
This quickstart includes one service: This quickstart includes one service:
@ -14,8 +14,10 @@ This quickstart includes one service:
1. Open two terminal windows. In one terminal window, navigate to the `checkout` service. In the other terminal window, navigate to the `order-processor` service. Install dependencies for each service and run both services with resiliency enabled via the config.yaml: 1. Open two terminal windows. In one terminal window, navigate to the `checkout` service. In the other terminal window, navigate to the `order-processor` service. Install dependencies for each service and run both services with resiliency enabled via the config.yaml:
### CSharp example: ### C# example
##### Order Processor Service: ##### Order Processor Service:
```bash ```bash
cd ../service_invocation/csharp/http/order-processor cd ../service_invocation/csharp/http/order-processor
dotnet restore dotnet restore
@ -24,6 +26,7 @@ dapr run --app-port 7001 --app-id order-processor --config ../config.yaml --comp
``` ```
##### Checkout Service: ##### Checkout Service:
```bash ```bash
cd ../service_invocation/csharp/http/checkout cd ../service_invocation/csharp/http/checkout
dotnet restore dotnet restore
@ -31,8 +34,10 @@ dotnet build
dapr run --app-id checkout --config ../config.yaml --components-path ../../../components/ --app-protocol http --dapr-http-port 3500 -- dotnet run dapr run --app-id checkout --config ../config.yaml --components-path ../../../components/ --app-protocol http --dapr-http-port 3500 -- dotnet run
``` ```
### Go example: ### Go example
##### Order Processor Service: ##### Order Processor Service:
```bash ```bash
cd ../service_invocation/go/http/order-processor cd ../service_invocation/go/http/order-processor
go build . go build .
@ -40,61 +45,73 @@ dapr run --app-port 6001 --app-id order-processor --config ../config.yaml --comp
``` ```
##### Checkout Service: ##### Checkout Service:
```bash ```bash
cd ../service_invocation/go/http/checkout cd ../service_invocation/go/http/checkout
go build . go build .
dapr run --app-id checkout --config ../config.yaml --components-path ../../../components/ --app-protocol http --dapr-http-port 3500 -- go run . dapr run --app-id checkout --config ../config.yaml --components-path ../../../components/ --app-protocol http --dapr-http-port 3500 -- go run .
``` ```
### Java example: ### Java example
##### Order Processor Service:
##### Order Processor Service
```bash ```bash
cd ../service_invocation/java/http/order-processor cd ../service_invocation/java/http/order-processor
mvn clean install mvn clean install
dapr run --app-id order-processor --config ../config.yaml --components-path ../../../components/ --app-port 9001 --app-protocol http --dapr-http-port 3501 -- java -jar target/OrderProcessingService-0.0.1-SNAPSHOT.jar dapr run --app-id order-processor --config ../config.yaml --components-path ../../../components/ --app-port 9001 --app-protocol http --dapr-http-port 3501 -- java -jar target/OrderProcessingService-0.0.1-SNAPSHOT.jar
``` ```
##### Checkout Service: ##### Checkout Service
```bash ```bash
cd ../service_invocation/java/http/checkout cd ../service_invocation/java/http/checkout
mvn clean install mvn clean install
dapr run --app-id checkout --config ../config.yaml --components-path ../../../components/ --app-protocol http --dapr-http-port 3500 -- java -jar target/CheckoutService-0.0.1-SNAPSHOT.jar dapr run --app-id checkout --config ../config.yaml --components-path ../../../components/ --app-protocol http --dapr-http-port 3500 -- java -jar target/CheckoutService-0.0.1-SNAPSHOT.jar
``` ```
### JavaScript example: ### JavaScript example
##### Order Processor Service:
##### Order Processor Service
```bash ```bash
cd ../service_invocation/javascript/http/order-processor cd ../service_invocation/javascript/http/order-processor
npm install npm install
dapr run --app-port 5001 --app-id order-processor --config ../config.yaml --components-path ../../../components/ --app-protocol http --dapr-http-port 3501 -- npm start dapr run --app-port 5001 --app-id order-processor --config ../config.yaml --components-path ../../../components/ --app-protocol http --dapr-http-port 3501 -- npm start
``` ```
##### Checkout Service: ##### Checkout Service
```bash ```bash
cd ../service_invocation/javascript/http/checkout cd ../service_invocation/javascript/http/checkout
npm install npm install
dapr run --app-id checkout --config ../config.yaml --components-path ../../../components/ --app-protocol http --dapr-http-port 3500 -- npm start dapr run --app-id checkout --config ../config.yaml --components-path ../../../components/ --app-protocol http --dapr-http-port 3500 -- npm start
``` ```
### Python example: ### Python example
##### Order Processor Service:
##### Order Processor Service
```bash ```bash
cd ../service_invocation/python/http/order-processor cd ../service_invocation/python/http/order-processor
pip3 install -r requirements.txt pip3 install -r requirements.txt
dapr run --app-port 8001 --app-id order-processor --config ../config.yaml --components-path ../../../components/ --app-protocol http --dapr-http-port 3501 -- python3 app.py dapr run --app-port 8001 --app-id order-processor --config ../config.yaml --components-path ../../../components/ --app-protocol http --dapr-http-port 3501 -- python3 app.py
``` ```
##### Checkout Service: ##### Checkout Service
```bash ```bash
cd ../service_invocation/python/http/checkout cd ../service_invocation/python/http/checkout
pip3 install -r requirements.txt pip3 install -r requirements.txt
dapr run --app-id checkout --config ../config.yaml --components-path ../../../components/ --app-protocol http --dapr-http-port 3500 -- python3 app.py dapr run --app-id checkout --config ../config.yaml --components-path ../../../components/ --app-protocol http --dapr-http-port 3500 -- python3 app.py
``` ```
### Expected output: ### Expected output
Once both services are running, the `order-processor` service will recieve orders from the `checkout`service continuously using Dapr's service invoke API. Once both services are running, the `order-processor` service will recieve orders from the `checkout`service continuously using Dapr's service invoke API.
##### `order-processor` output: ##### `order-processor` output
```bash ```bash
== APP == Order received: { orderId: 1 } == APP == Order received: { orderId: 1 }
== APP == Order received: { orderId: 2 } == APP == Order received: { orderId: 2 }
@ -105,19 +122,14 @@ Once both services are running, the `order-processor` service will recieve order
Simulate a system failure by stopping the `order-processor` service running in your second terminal window. Simulate a system failure by stopping the `order-processor` service running in your second terminal window.
##### Windows
```script ```script
CTRL + C CTRL + C
``` ```
##### Mac ### Observe retry and circuit breaker policies are applied
```script
CMD + C
```
### Observe retry and circuit breaker policies are applied:
Policies defined in the resiliency.yaml spec: Policies defined in the resiliency.yaml spec:
```yaml ```yaml
retryForever: retryForever:
policy: constant policy: constant
@ -131,7 +143,8 @@ circuitBreakers:
trip: consecutiveFailures >= 5 trip: consecutiveFailures >= 5
``` ```
##### Applied policies: ##### Applied policies
```bash ```bash
INFO[0005] Error processing operation endpoint[order-processor, order-processor:orders]. Retrying... INFO[0005] Error processing operation endpoint[order-processor, order-processor:orders]. Retrying...
INFO[0025] Circuit breaker "order-processor:orders" changed state from closed to open INFO[0025] Circuit breaker "order-processor:orders" changed state from closed to open
@ -140,40 +153,53 @@ INFO[0030] Circuit breaker "order-processor:orders" changed state from half-open
``` ```
### Simulate the application recovering by restarting the order-processor service: ### Simulate the application recovering by restarting the order-processor service:
Simulate the `order-processor` service recovering by restarting the application using the `dapr run` command: Simulate the `order-processor` service recovering by restarting the application using the `dapr run` command:
### CSharp example: ### C# example
##### Order Processor Service:
##### Order Processor Service
```bash ```bash
dapr run --app-port 7001 --app-id order-processor --config ../config.yaml --components-path --app-protocol http --dapr-http-port 3501 -- dotnet run dapr run --app-port 7001 --app-id order-processor --config ../config.yaml --components-path --app-protocol http --dapr-http-port 3501 -- dotnet run
``` ```
### Go example: ### Go example
##### Order Processor Service:
##### Order Processor Service
```bash ```bash
dapr run --app-port 6001 --app-id order-processor --config ../config.yaml --components-path --app-protocol http --dapr-http-port 3501 -- go run . dapr run --app-port 6001 --app-id order-processor --config ../config.yaml --components-path --app-protocol http --dapr-http-port 3501 -- go run .
``` ```
### Java example: ### Java example
##### Order Processor Service:
##### Order Processor Service
```bash ```bash
dapr run --app-id order-processor --config ../config.yaml --components-path --app-port 9001 --app-protocol http --dapr-http-port 3501 -- java -jar target/OrderProcessingService-0.0.1-SNAPSHOT.jar dapr run --app-id order-processor --config ../config.yaml --components-path --app-port 9001 --app-protocol http --dapr-http-port 3501 -- java -jar target/OrderProcessingService-0.0.1-SNAPSHOT.jar
``` ```
### JavaScript example: ### JavaScript example
##### Order Processor Service:
##### Order Processor Service
```bash ```bash
dapr run --app-port 5001 --app-id order-processor --config ../config.yaml --components-path --app-protocol http --dapr-http-port 3501 -- npm start dapr run --app-port 5001 --app-id order-processor --config ../config.yaml --components-path --app-protocol http --dapr-http-port 3501 -- npm start
``` ```
### Python example: ### Python example
##### Order Processor Service: ##### Order Processor Service:
```bash ```bash
dapr run --app-port 8001 --app-id order-processor --config ../config.yaml --components-path --app-protocol http --dapr-http-port 3501 -- python3 app.py dapr run --app-port 8001 --app-id order-processor --config ../config.yaml --components-path --app-protocol http --dapr-http-port 3501 -- python3 app.py
``` ```
### Observe orders have resumed sequentially: ### Observe orders have resumed sequentially:
##### `order-processor` output: ##### `order-processor` output:
```bash ```bash
== APP == Order received: { orderId: 4 } == APP == Order received: { orderId: 4 }
== APP == Order received: { orderId: 5 } == APP == Order received: { orderId: 5 }
@ -182,8 +208,8 @@ dapr run --app-port 8001 --app-id order-processor --config ../config.yaml --comp
``` ```
### Stop the apps with Dapr ### Stop the apps with Dapr
```bash ```bash
dapr stop --app-id order-processor dapr stop --app-id order-processor
dapr stop --app-id checkout dapr stop --app-id checkout
``` ```

View File

@ -1,38 +1,21 @@
# Service Invocation # Service Invocation
In this quickstart, you'll create a checkout service and an order processor service to demonstrate how to use the service invocation API. The checkout service uses Dapr's http proxying capability to invoke a method on the order processing service. In this quickstart, you'll create a checkout service and an order-processor service to demonstrate how to use the service invocation API. The checkout service uses Dapr's HTTP proxying capability to invoke a method on the order processing service.
Visit [this](https://docs.dapr.io/developing-applications/building-blocks/service-invocation/) link for more information about Dapr and service invocation. Check out the documentation about [service invocation](https://docs.dapr.io/developing-applications/building-blocks/service-invocation/) for more details.
This quickstart includes one checkout service: This quickstart includes one checkout service: Go client service `checkout`
- Go client service `checkout` And one order processor service: Go order-processor service `order-processor`
And one order processor service:
- Go order-processor service `order-processor`
### Run Go order-processor with Dapr ### Run Go order-processor with Dapr
1. Open a new terminal window and navigate to `order-processor` directory: 1. Run the order-processor app with Dapr in the `order-processor` folder:
<!-- STEP
name: Build Go file
-->
```bash
cd ./order-processor
go build .
```
<!-- END_STEP -->
2. Run the Go order-processor app with Dapr:
<!-- STEP <!-- STEP
name: Run order-processor service name: Run order-processor service
expected_stdout_lines: expected_stdout_lines:
- '== APP == Order received : {"orderId":10}' - '== APP == Order received: {"orderId":10}'
- "Exited App successfully" - "Exited App successfully"
expected_stderr_lines: expected_stderr_lines:
output_match_mode: substring output_match_mode: substring
@ -42,26 +25,19 @@ sleep: 15
```bash ```bash
cd ./order-processor cd ./order-processor
dapr run --app-port 6001 --app-id order-processor --app-protocol http --dapr-http-port 3501 -- go run . dapr run \
--app-port 6001 \
--app-id order-processor \
--app-protocol http \
--dapr-http-port 3501 \
-- go run .
``` ```
<!-- END_STEP --> <!-- END_STEP -->
### Run Go checkout with Dapr ### Run Go checkout with Dapr
1. Open a new terminal window and navigate to `checkout` directory: 1. Open a new terminal window and navigate to `checkout` directory, then run the Go checkout app with Dapr:
<!-- STEP
name: Build Go file
-->
```bash
cd ./checkout
go build .
```
<!-- END_STEP -->
2. Run the Go checkout app with Dapr:
<!-- STEP <!-- STEP
name: Run checkout service name: Run checkout service
@ -77,11 +53,16 @@ sleep: 15
```bash ```bash
cd ./checkout cd ./checkout
dapr run --app-id checkout --app-protocol http --dapr-http-port 3500 -- go run . dapr run \
--app-id checkout \
--dapr-http-port 3500 \
-- go run .
``` ```
<!-- END_STEP --> <!-- END_STEP -->
To stop:
```bash ```bash
dapr stop --app-id checkout dapr stop --app-id checkout
dapr stop --app-id order-processor dapr stop --app-id order-processor

View File

@ -8,41 +8,44 @@ import (
"os" "os"
"strconv" "strconv"
"strings" "strings"
"time"
) )
func main() { func main() {
var DAPR_HOST, DAPR_HTTP_PORT string daprHost := os.Getenv("DAPR_HOST")
var okHost, okPort bool if daprHost == "" {
if DAPR_HOST, okHost = os.LookupEnv("DAPR_HOST"); !okHost { daprHost = "http://localhost"
DAPR_HOST = "http://localhost"
} }
if DAPR_HTTP_PORT, okPort = os.LookupEnv("DAPR_HTTP_PORT"); !okPort { daprHttpPort := os.Getenv("DAPR_HTTP_PORT")
DAPR_HTTP_PORT = "3500" if daprHttpPort == "" {
daprHttpPort = "3500"
}
client := &http.Client{
Timeout: 15 * time.Second,
} }
for i := 1; i <= 20; i++ { for i := 1; i <= 20; i++ {
order := "{\"orderId\":" + strconv.Itoa(i) + "}" order := `{"orderId":` + strconv.Itoa(i) + "}"
client := &http.Client{} req, err := http.NewRequest("POST", daprHost+":"+daprHttpPort+"/orders", strings.NewReader(order))
req, err := http.NewRequest("POST", DAPR_HOST+":"+DAPR_HTTP_PORT+"/orders", strings.NewReader(order))
if err != nil { if err != nil {
fmt.Print(err.Error()) log.Fatal(err.Error())
os.Exit(1)
} }
// Adding app id as part of th header // Adding app id as part of th header
req.Header.Add("dapr-app-id", "order-processor") req.Header.Add("dapr-app-id", "order-processor")
// Invoking a service // Invoking a service
response, err := client.Do(req) response, err := client.Do(req)
if err != nil { if err != nil {
fmt.Print(err.Error()) log.Fatal(err.Error())
os.Exit(1)
} }
// Read the response
result, err := ioutil.ReadAll(response.Body) result, err := ioutil.ReadAll(response.Body)
if err != nil { if err != nil {
log.Fatal(err) log.Fatal(err)
} }
response.Body.Close()
fmt.Println("Order passed: ", string(result)) fmt.Println("Order passed:", string(result))
} }
} }

View File

@ -1,3 +1,3 @@
module dapr_example module checkout_example
go 1.18 go 1.19

View File

@ -1,8 +0,0 @@
apiVersion: dapr.io/v1alpha1
kind: Configuration
metadata:
name: config
spec:
features:
- name: Resiliency
enabled: true

View File

@ -12,17 +12,24 @@ import (
func getOrder(w http.ResponseWriter, r *http.Request) { func getOrder(w http.ResponseWriter, r *http.Request) {
data, err := ioutil.ReadAll(r.Body) data, err := ioutil.ReadAll(r.Body)
if err != nil { if err != nil {
log.Fatal(err) log.Println("Error reading body:", err.Error())
} }
fmt.Println("Order received : ", string(data)) fmt.Println("Order received:", string(data))
_, err = w.Write(data) _, err = w.Write(data)
if err != nil { if err != nil {
log.Println("Error in writing the result obj") log.Println("Error writing the response:", err.Error())
} }
} }
func main() { func main() {
// Create a new router and respond to POST /orders requests
r := mux.NewRouter() r := mux.NewRouter()
r.HandleFunc("/orders", getOrder).Methods("POST") r.HandleFunc("/orders", getOrder).Methods("POST")
_ = http.ListenAndServe(":6001", r)
// Start the server listening on port 6001
// This is a blocking call
err := http.ListenAndServe(":6001", r)
if err != http.ErrServerClosed {
log.Println("Error starting HTTP server")
}
} }

View File

@ -1,5 +1,5 @@
module dapr_example module order_processor_example
go 1.18 go 1.19
require github.com/gorilla/mux v1.8.0 require github.com/gorilla/mux v1.8.0

View File

@ -1,36 +1,22 @@
# Dapr state management (HTTP Client) # Dapr state management (HTTP Client)
In this quickstart, you'll create a microservice to demonstrate Dapr's state management API. The service generates messages to store data in a state store. See [Why state management](#why-state-management) to understand when this pattern might be a good choice for your software architecture. In this quickstart, you'll create a microservice to demonstrate Dapr's state management API. The service generates messages to store data in a state store.
Visit [this](https://docs.dapr.io/developing-applications/building-blocks/state-management/) link for more information about Dapr and State Management. Visit the Dapr documentation on [State Management](https://docs.dapr.io/developing-applications/building-blocks/state-management/) for more information.
> **Note:** This example leverages HTTP `requests` only. If you are looking for the example using the Dapr Client SDK (recommended) [click here](../sdk/). > **Note:** This example leverages plain HTTP. You can find an example using the Dapr Client SDK (recommended) in the [`sdk` folder](../sdk/).
This quickstart includes one service: This quickstart includes one service: Go client service `order-processor`
- Go client service `order-processor`
### Run Go service with Dapr ### Run Go service with Dapr
1. Open a new terminal window and navigate to `order-processor` directory: 1. Run the Go service app with Dapr in the `order-processor` folder:
<!-- STEP
name: Build Go file
-->
```bash
cd ./order-processor
go build .
```
<!-- END_STEP -->
2. Run the Go service app with Dapr:
<!-- STEP <!-- STEP
name: Run order-processor service name: Run order-processor service
expected_stdout_lines: expected_stdout_lines:
- '== APP == Getting Order: "{\"orderId\":1}"' - '== APP == Retrieved Order: "{\"orderId\":1}"'
- '== APP == Getting Order: "{\"orderId\":2}"' - '== APP == Retrieved Order: "{\"orderId\":2}"'
- "Exited App successfully" - "Exited App successfully"
expected_stderr_lines: expected_stderr_lines:
output_match_mode: substring output_match_mode: substring
@ -40,11 +26,10 @@ sleep: 15
```bash ```bash
cd ./order-processor cd ./order-processor
dapr run --app-id order-processor --components-path ../../../components -- go run . dapr run \
--app-id order-processor \
--components-path ../../../components \
-- go run .
``` ```
<!-- END_STEP --> <!-- END_STEP -->
```bash
dapr stop --app-id order-processor
```

View File

@ -12,43 +12,63 @@ import (
"time" "time"
) )
const stateStoreComponentName = "statestore"
func main() { func main() {
var DAPR_HOST, DAPR_HTTP_PORT string daprHost := os.Getenv("DAPR_HOST")
var okHost, okPort bool if daprHost == "" {
if DAPR_HOST, okHost = os.LookupEnv("DAPR_HOST"); !okHost { daprHost = "http://localhost"
DAPR_HOST = "http://localhost"
} }
if DAPR_HTTP_PORT, okPort = os.LookupEnv("DAPR_HTTP_PORT"); !okPort { daprHttpPort := os.Getenv("DAPR_HTTP_PORT")
DAPR_HTTP_PORT = "3500" if daprHttpPort == "" {
daprHttpPort = "3500"
}
client := http.Client{
Timeout: 15 * time.Second,
} }
DAPR_STATE_STORE := "statestore"
for i := 1; i <= 100; i++ { for i := 1; i <= 100; i++ {
orderId := i orderId := i
order := "{\"orderId\":" + strconv.Itoa(orderId) + "}" order := `{"orderId":` + strconv.Itoa(orderId) + "}"
state, _ := json.Marshal([]map[string]string{ state, _ := json.Marshal([]map[string]string{
{"key": strconv.Itoa(orderId), "value": order}, {
"key": strconv.Itoa(orderId),
"value": order,
},
}) })
responseBody := bytes.NewBuffer(state)
// Save state into a state store // Save state into a state store
_, _ = http.Post(DAPR_HOST+":"+DAPR_HTTP_PORT+"/v1.0/state/"+DAPR_STATE_STORE, "application/json", responseBody) res, err := client.Post(daprHost+":"+daprHttpPort+"/v1.0/state/"+stateStoreComponentName, "application/json", bytes.NewReader(state))
log.Println("Saving Order: " + order) if err != nil {
panic(err)
}
res.Body.Close()
fmt.Println("Saved Order:", order)
// Get state from a state store // Get state from a state store
getResponse, err := http.Get(DAPR_HOST + ":" + DAPR_HTTP_PORT + "/v1.0/state/" + DAPR_STATE_STORE + "/" + strconv.Itoa(orderId)) getResponse, err := client.Get(daprHost + ":" + daprHttpPort + "/v1.0/state/" + stateStoreComponentName + "/" + strconv.Itoa(orderId))
if err != nil { if err != nil {
fmt.Print(err.Error()) panic(err)
os.Exit(1)
} }
result, _ := ioutil.ReadAll(getResponse.Body) result, err := ioutil.ReadAll(getResponse.Body)
fmt.Println("Getting Order: ", string(result)) if err != nil {
panic(err)
}
fmt.Println("Retrieved Order:", string(result))
getResponse.Body.Close()
// Delete state from the state store // Delete state from the state store
req, _ := http.NewRequest(http.MethodDelete, DAPR_HOST+":"+DAPR_HTTP_PORT+"/v1.0/state/"+DAPR_STATE_STORE+"/"+strconv.Itoa(orderId), nil) req, err := http.NewRequest(http.MethodDelete, daprHost+":"+daprHttpPort+"/v1.0/state/"+stateStoreComponentName+"/"+strconv.Itoa(orderId), nil)
client := &http.Client{} if err != nil {
_, _ = client.Do(req) panic(err)
log.Println("Deleting Order: " + order) }
res, err = client.Do(req)
if err != nil {
panic(err)
}
res.Body.Close()
log.Println("Deleted Order:", order)
time.Sleep(5000) time.Sleep(5000)
} }

View File

@ -1,3 +1,3 @@
module dapr_example module order_processor_example
go 1.18 go 1.19

View File

@ -1,36 +1,22 @@
# Dapr state management # Dapr state management
In this quickstart, you'll create a microservice to demonstrate Dapr's state management API. The service generates messages to store data in a state store. See [Why state management](#why-state-management) to understand when this pattern might be a good choice for your software architecture. In this quickstart, you'll create a microservice to demonstrate Dapr's state management API. The service generates messages to store data in a state store.
Visit [this](https://docs.dapr.io/developing-applications/building-blocks/state-management/) link for more information about Dapr and State Management. Visit the Dapr documentation on [State Management](https://docs.dapr.io/developing-applications/building-blocks/state-management/) for more information.
> **Note:** This example leverages the Dapr client SDK. If you are looking for the example using only HTTP `requests` [click here](../http). > **Note:** This example leverages the Dapr Client SDK. You can find an example using plain HTTP in the [`http` folder](../http/).
This quickstart includes one service: This quickstart includes one service: Go client service `order-processor`
- Go client service `order-processor`
### Run Go service with Dapr ### Run Go service with Dapr
1. Open a new terminal window and navigate to `order-processor` directory: 1. Run the Go service app with Dapr in the `order-processor` folder:
<!-- STEP
name: Build Go file
-->
```bash
cd ./order-processor
go build .
```
<!-- END_STEP -->
2. Run the Go service app with Dapr:
<!-- STEP <!-- STEP
name: Run order-processor service name: Run order-processor service
expected_stdout_lines: expected_stdout_lines:
- '== APP == Getting Order: {"orderId":1}' - '== APP == Retrieved Order: {"orderId":1}'
- '== APP == Getting Order: {"orderId":2}' - '== APP == Retrieved Order: {"orderId":2}'
- "Exited App successfully" - "Exited App successfully"
expected_stderr_lines: expected_stderr_lines:
output_match_mode: substring output_match_mode: substring
@ -40,11 +26,10 @@ sleep: 15
```bash ```bash
cd ./order-processor cd ./order-processor
dapr run --app-id order-processor --components-path ../../../components -- go run . dapr run \
--app-id order-processor \
--components-path ../../../components \
-- go run .
``` ```
<!-- END_STEP --> <!-- END_STEP -->
```bash
dapr stop --app-id order-processor
```

View File

@ -1,8 +0,0 @@
apiVersion: dapr.io/v1alpha1
kind: Configuration
metadata:
name: config
spec:
features:
- name: Resiliency
enabled: true

View File

@ -10,28 +10,38 @@ import (
dapr "github.com/dapr/go-sdk/client" dapr "github.com/dapr/go-sdk/client"
) )
const stateStoreComponentName = "statestore"
func main() { func main() {
client, err := dapr.NewClient()
if err != nil {
log.Fatal(err)
}
for i := 1; i <= 100; i++ { for i := 1; i <= 100; i++ {
orderId := i orderId := i
order := "{\"orderId\":" + strconv.Itoa(orderId) + "}" order := `{"orderId":` + strconv.Itoa(orderId) + "}"
client, err := dapr.NewClient()
STATE_STORE_NAME := "statestore"
if err != nil {
panic(err)
}
ctx := context.Background()
// Save state into the state store // Save state into the state store
_ = client.SaveState(ctx, STATE_STORE_NAME, strconv.Itoa(orderId), []byte(order), nil) err = client.SaveState(context.Background(), stateStoreComponentName, strconv.Itoa(orderId), []byte(order), nil)
log.Print("Saving Order: " + string(order)) if err != nil {
log.Fatal(err)
}
fmt.Println("Saved Order:", string(order))
// Get state from the state store // Get state from the state store
result, _ := client.GetState(ctx, STATE_STORE_NAME, strconv.Itoa(orderId), nil) result, err := client.GetState(context.Background(), stateStoreComponentName, strconv.Itoa(orderId), nil)
fmt.Println("Getting Order: " + string(result.Value)) if err != nil {
log.Fatal(err)
}
fmt.Println("Retrieved Order:", string(result.Value))
// Delete state from the state store // Delete state from the state store
_ = client.DeleteState(ctx, STATE_STORE_NAME, strconv.Itoa(orderId), nil) err = client.DeleteState(context.Background(), stateStoreComponentName, strconv.Itoa(orderId), nil)
log.Print("Deleting Order: " + string(order)) if err != nil {
log.Fatal(err)
}
fmt.Println("Deleted Order:", string(order))
time.Sleep(5000) time.Sleep(5000)
} }

View File

@ -1,11 +1,10 @@
module dapr_example module order_processor_sdk_example
go 1.18 go 1.19
require github.com/dapr/go-sdk v1.5.0 require github.com/dapr/go-sdk v1.6.0
require ( require (
github.com/dapr/dapr v1.8.0 // indirect
github.com/golang/protobuf v1.5.2 // indirect github.com/golang/protobuf v1.5.2 // indirect
github.com/pkg/errors v0.9.1 // indirect github.com/pkg/errors v0.9.1 // indirect
golang.org/x/net v0.0.0-20220621193019-9d032be2e588 // indirect golang.org/x/net v0.0.0-20220621193019-9d032be2e588 // indirect

View File

@ -11,10 +11,8 @@ github.com/cncf/udpa/go v0.0.0-20210930031921-04548b0d99d4/go.mod h1:6pvJx4me5XP
github.com/cncf/xds/go v0.0.0-20210922020428-25de7278fc84/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= github.com/cncf/xds/go v0.0.0-20210922020428-25de7278fc84/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs=
github.com/cncf/xds/go v0.0.0-20211001041855-01bcc9b48dfe/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= github.com/cncf/xds/go v0.0.0-20211001041855-01bcc9b48dfe/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs=
github.com/cncf/xds/go v0.0.0-20211011173535-cb28da3451f1/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= github.com/cncf/xds/go v0.0.0-20211011173535-cb28da3451f1/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs=
github.com/dapr/dapr v1.8.0 h1:ZAAoBe6wuFp7k4tIHB7ajZXVTtGeDeVqIPrldzo3dF0= github.com/dapr/go-sdk v1.6.0 h1:jg5A2khSCHF8bGZsig5RWN/gD0jjitszc2V6Uq2pPdY=
github.com/dapr/dapr v1.8.0/go.mod h1:yAsDiK5oecG0htw2S8JG9RFaeHJVdlTfZyOrL57AvRM= github.com/dapr/go-sdk v1.6.0/go.mod h1:KLQBltoD9K0w5hKTihdcyg9Epob9gypwL5dYcQzPro4=
github.com/dapr/go-sdk v1.5.0 h1:OVkrupquJEOL1qRtwKcMVrFKYhw4UJQvgOJNduo2VxE=
github.com/dapr/go-sdk v1.5.0/go.mod h1:Cvz3taCVu22WCNEUbc9/szvG/yJxWPAV4dcaG+zDWA4=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4=
@ -51,6 +49,8 @@ github.com/google/go-cmp v0.5.8 h1:e6P7q2lk1O+qJJb4BtCQXlK8vWEO8V1ZeuEdJNOqZyg=
github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I= github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I=
github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw= github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw=
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e h1:fD57ERR4JtEqsWbfPhv4DMiApHyliiK5xCTNVSPiaAs=
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
@ -140,8 +140,8 @@ google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQ
google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
google.golang.org/protobuf v1.28.0 h1:w43yiav+6bVFTBQFZX0r7ipe9JQ1QsbMgHwbBziscLw= google.golang.org/protobuf v1.28.0 h1:w43yiav+6bVFTBQFZX0r7ipe9JQ1QsbMgHwbBziscLw=
google.golang.org/protobuf v1.28.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= google.golang.org/protobuf v1.28.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f h1:BLraFXnmrev5lT+xlilqcH8XK9/i0At2xKjWk4p6zsU=
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.2.3/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.3/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=