mirror of
https://gitee.com/johng/gf.git
synced 2024-11-30 03:07:45 +08:00
Update README to demonstrate how to configure polaris (#2724)
This commit is contained in:
parent
8aff08581f
commit
92e21c275c
@ -38,7 +38,7 @@ func main() {
|
||||
conf := config.NewDefaultConfiguration([]string{"183.47.111.80:8091"})
|
||||
|
||||
// TTL egt 2*time.Second
|
||||
gsvc.SetRegistry(polaris.NewRegistryWithConfig(conf, polaris.WithTTL(10)))
|
||||
gsvc.SetRegistry(polaris.NewWithConfig(conf, polaris.WithTTL(10)))
|
||||
|
||||
s := g.Server(`hello.svc`)
|
||||
s.BindHandler("/", func(r *ghttp.Request) {
|
||||
@ -70,7 +70,7 @@ import (
|
||||
func main() {
|
||||
conf := config.NewDefaultConfiguration([]string{"183.47.111.80:8091"})
|
||||
|
||||
gsvc.SetRegistry(polaris.NewRegistryWithConfig(conf, polaris.WithTTL(10)))
|
||||
gsvc.SetRegistry(polaris.NewWithConfig(conf, polaris.WithTTL(10)))
|
||||
|
||||
for i := 0; i < 100; i++ {
|
||||
res, err := g.Client().Get(gctx.New(), `http://hello.svc/`)
|
||||
|
@ -44,7 +44,7 @@ func main() {
|
||||
conf := config.NewDefaultConfiguration([]string{"183.47.111.80:8091"})
|
||||
|
||||
// TTL egt 2*time.Second
|
||||
gsvc.SetRegistry(polaris.NewRegistryWithConfig(conf, polaris.WithTTL(10)))
|
||||
gsvc.SetRegistry(polaris.NewWithConfig(conf, polaris.WithTTL(10)))
|
||||
|
||||
s := g.Server(`hello.svc`)
|
||||
s.BindHandler("/", func(r *ghttp.Request) {
|
||||
@ -77,7 +77,7 @@ import (
|
||||
func main() {
|
||||
conf := config.NewDefaultConfiguration([]string{"183.47.111.80:8091"})
|
||||
|
||||
gsvc.SetRegistry(polaris.NewRegistryWithConfig(conf, polaris.WithTTL(10)))
|
||||
gsvc.SetRegistry(polaris.NewWithConfig(conf, polaris.WithTTL(10)))
|
||||
|
||||
for i := 0; i < 100; i++ {
|
||||
res, err := g.Client().Get(gctx.New(), `http://hello.svc/`)
|
||||
@ -94,4 +94,4 @@ func main() {
|
||||
|
||||
## 协议
|
||||
|
||||
`GoFrame Polaris` 使用非常友好的 [MIT](../../../LICENSE) 开源协议进行发布,永久`100%`开源免费。
|
||||
`GoFrame Polaris` 使用非常友好的 [MIT](../../../LICENSE) 开源协议进行发布,永久`100%`开源免费。
|
||||
|
Loading…
Reference in New Issue
Block a user