2023-07-06 20:41:24 +08:00
|
|
|
// Copyright GoFrame Author(https://goframe.org). All Rights Reserved.
|
|
|
|
|
//
|
|
|
|
|
// This Source Code Form is subject to the terms of the MIT License.
|
|
|
|
|
// If a copy of the MIT was not distributed with this file,
|
|
|
|
|
// You can obtain one at https://github.com/gogf/gf.
|
|
|
|
|
|
2022-01-27 16:50:31 +08:00
|
|
|
package main
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"github.com/gogf/gf/contrib/registry/etcd/v2"
|
|
|
|
|
"github.com/gogf/gf/v2/frame/g"
|
2022-05-23 15:08:11 +08:00
|
|
|
"github.com/gogf/gf/v2/net/gsel"
|
2022-01-27 16:50:31 +08:00
|
|
|
"github.com/gogf/gf/v2/net/gsvc"
|
|
|
|
|
"github.com/gogf/gf/v2/os/gctx"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
func main() {
|
|
|
|
|
gsvc.SetRegistry(etcd.New(`127.0.0.1:2379`))
|
2022-05-23 15:08:11 +08:00
|
|
|
gsel.SetBuilder(gsel.NewBuilderRoundRobin())
|
2022-01-27 16:50:31 +08:00
|
|
|
|
2023-03-17 17:51:10 +08:00
|
|
|
for i := 0; i < 10; i++ {
|
|
|
|
|
ctx := gctx.New()
|
|
|
|
|
res := g.Client().GetContent(ctx, `http://hello.svc/`)
|
|
|
|
|
g.Log().Info(ctx, res)
|
2022-01-27 16:50:31 +08:00
|
|
|
}
|
|
|
|
|
}
|