/
echo.pb.go
155 lines (131 loc) · 4.74 KB
/
echo.pb.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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
// Code generated by protoc-gen-go.
// source: echo.proto
// DO NOT EDIT!
/*
Package service is a generated protocol buffer package.
It is generated from these files:
echo.proto
arith.proto
It has these top-level messages:
EchoRequest
EchoResponse
ArithRequest
ArithResponse
*/
package service
import proto "github.com/golang/protobuf/proto"
import fmt "fmt"
import math "math"
import "log"
import "net/rpc"
import "github.com/liuyuanlin/rmqrpc"
// Reference imports to suppress errors if they are not otherwise used.
var _ = proto.Marshal
var _ = fmt.Errorf
var _ = math.Inf
// This is a compile-time assertion to ensure that this generated file
// is compatible with the proto package it is being compiled against.
// A compilation error at this line likely means your copy of the
// proto package needs to be updated.
const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package
type EchoRequest struct {
Msg string `protobuf:"bytes,1,opt,name=msg" json:"msg,omitempty"`
}
func (m *EchoRequest) Reset() { *m = EchoRequest{} }
func (m *EchoRequest) String() string { return proto.CompactTextString(m) }
func (*EchoRequest) ProtoMessage() {}
func (*EchoRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{0} }
func (m *EchoRequest) GetMsg() string {
if m != nil {
return m.Msg
}
return ""
}
type EchoResponse struct {
Msg string `protobuf:"bytes,1,opt,name=msg" json:"msg,omitempty"`
}
func (m *EchoResponse) Reset() { *m = EchoResponse{} }
func (m *EchoResponse) String() string { return proto.CompactTextString(m) }
func (*EchoResponse) ProtoMessage() {}
func (*EchoResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{1} }
func (m *EchoResponse) GetMsg() string {
if m != nil {
return m.Msg
}
return ""
}
func init() {
proto.RegisterType((*EchoRequest)(nil), "service.EchoRequest")
proto.RegisterType((*EchoResponse)(nil), "service.EchoResponse")
}
type EchoService interface {
Echo(in *EchoRequest, out *EchoResponse) error
EchoTwice(in *EchoRequest, out *EchoResponse) error
}
// StartEchoServiceServer start one rpc server
func StartEchoServiceServer(uri string, exchangeName string, queueName string, x EchoService) (err error) {
srv := rpc.NewServer()
if err = srv.RegisterName("EchoService", x); err != nil {
log.Fatal(err)
return
}
go srv.ServeCodec(rmqrpc.NewServerCodec(uri, exchangeName, queueName))
return
}
// RegisterEchoService publish the given EchoService implementation on the server.
func RegisterEchoService(srv *rpc.Server, x EchoService) error {
if err := srv.RegisterName("EchoService", x); err != nil {
return err
}
return nil
}
// NewEchoServiceServer returns a new EchoService Server.
func NewEchoServiceServer(x EchoService) *rpc.Server {
srv := rpc.NewServer()
if err := srv.RegisterName("EchoService", x); err != nil {
log.Fatal(err)
}
return srv
}
type EchoServiceClient struct {
*rpc.Client
}
// NewEchoServiceClient returns a EchoService stub to handle
// requests to the set of EchoService at the other end of the connection.
func NewEchoServiceClient(uri string, exchangeName string, queueName string) *EchoServiceClient {
c := rpc.NewClientWithCodec(rmqrpc.NewClientCodec(uri, exchangeName, queueName))
return &EchoServiceClient{c}
}
func (c *EchoServiceClient) Echo(in *EchoRequest) (out *EchoResponse, err error) {
if in == nil {
in = new(EchoRequest)
}
out = new(EchoResponse)
if err = c.Call("EchoService.Echo", in, out); err != nil {
return nil, err
}
return out, nil
}
func (c *EchoServiceClient) EchoTwice(in *EchoRequest) (out *EchoResponse, err error) {
if in == nil {
in = new(EchoRequest)
}
out = new(EchoResponse)
if err = c.Call("EchoService.EchoTwice", in, out); err != nil {
return nil, err
}
return out, nil
}
func init() { proto.RegisterFile("echo.proto", fileDescriptor0) }
var fileDescriptor0 = []byte{
// 134 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0xe2, 0xe2, 0x4a, 0x4d, 0xce, 0xc8,
0xd7, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x62, 0x2f, 0x4e, 0x2d, 0x2a, 0xcb, 0x4c, 0x4e, 0x55,
0x92, 0xe7, 0xe2, 0x76, 0x4d, 0xce, 0xc8, 0x0f, 0x4a, 0x2d, 0x2c, 0x4d, 0x2d, 0x2e, 0x11, 0x12,
0xe0, 0x62, 0xce, 0x2d, 0x4e, 0x97, 0x60, 0x54, 0x60, 0xd4, 0xe0, 0x0c, 0x02, 0x31, 0x95, 0x14,
0xb8, 0x78, 0x20, 0x0a, 0x8a, 0x0b, 0xf2, 0xf3, 0x8a, 0x53, 0x31, 0x55, 0x18, 0xd5, 0x40, 0x8c,
0x08, 0x86, 0x98, 0x28, 0x64, 0xcc, 0xc5, 0x02, 0xe2, 0x0a, 0x89, 0xe8, 0x41, 0xed, 0xd0, 0x43,
0xb2, 0x40, 0x4a, 0x14, 0x4d, 0x14, 0x6a, 0xaa, 0x05, 0x17, 0x27, 0x88, 0x1f, 0x52, 0x0e, 0x32,
0x81, 0x14, 0x9d, 0x49, 0x6c, 0x60, 0x0f, 0x19, 0x03, 0x02, 0x00, 0x00, 0xff, 0xff, 0x00, 0xc1,
0xd4, 0xbd, 0xde, 0x00, 0x00, 0x00,
}