-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsample.go
executable file
·41 lines (34 loc) · 1005 Bytes
/
sample.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
package main
import (
"fmt"
"gitlab.int.jumei.com/JMArch/go-rpc/example/trusteeship"
jmthriftProto "gitlab.int.jumei.com/JMArch/go-rpc/jmthrift-proto"
larkProto "gitlab.int.jumei.com/JMArch/go-rpc/lark-proto"
"time"
)
func main() {
trans := jmthriftProto.NewLarkFramedTransportClient().WithLarkReqOption(&larkProto.LarkReqOption{
TargetService: "TrusteeshipTest",
}).MustValid()
prot := jmthriftProto.NewBinaryProtocolClient(trans)
client := trusteeship.NewTrusteeshipDataClientProtocol(trans, prot, prot)
for {
r, err := client.IsExist(123456)
if err != nil {
fmt.Println(err)
//return
}
fmt.Println(r)
fmt.Println(prot.GetOwlContext())
//设置自定义的 owl context
prot.SetOwlContext(map[string]interface{}{"k1": "v1"})
r, err = client.GetDecryptPhoneNumber(123456)
if err != nil {
fmt.Printf("error:%s, remote_ip:%s", err, trans.RespOption().ServerIP)
//return
}
fmt.Println(r)
fmt.Println(prot.GetOwlContext())
time.Sleep(time.Second)
}
}