MCPcopy
hub / github.com/hwholiday/learning_tools / main

Function main

micro_v2/client/main.go:17–43  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

15)
16
17func main() {
18 fmt.Println(time.Now().Format("2006-01-02 15:04:05"))
19 micReg := etcd.NewRegistry(registry.Addrs("172.13.3.160:2379"))
20 agent := test_agent.NewTestService("srv.test", grpc.NewClient(
21 client.Registry(micReg),
22 client.WrapCall(ecode.ClientEcodeCallWrapper),
23 client.Selector(selector.NewSelector(
24 selector.Registry(micReg),
25 )),
26 ))
27 var opss client.CallOption = func(o *client.CallOptions) {
28 o.RequestTimeout = time.Second * 5
29 o.DialTimeout = time.Second * 5
30 o.Retries = 3
31 o.SelectOptions = []selector.SelectOption{selector.WithFilter(selector.FilterLabel("gateway", "a"))}
32 //o.Address = []string{"127.0.0.1:8088"}
33 }
34 info, err := agent.RpcUserInfo(context.TODO(), &test_agent.ReqMsg{
35 UserName: "test user",
36 }, opss)
37 fmt.Println(time.Now().Format("2006-01-02 15:04:05"))
38 if err != nil {
39 log.Println(err)
40 log.Println(ecode.Cause(err).Message())
41 }
42 fmt.Println(info)
43}

Callers

nothing calls this directly

Calls 2

RpcUserInfoMethod · 0.95
MessageMethod · 0.65

Tested by

no test coverage detected