This commit is contained in:
joy.zhou
2019-07-31 17:40:27 +08:00
parent 704040c3fd
commit 8259670c12
5 changed files with 235 additions and 31 deletions
+162 -19
View File
@@ -165,6 +165,53 @@ func (m *DeliverMessageRequest) GetQos() int32 {
return 0
}
type QueryShareSubscribeRequest struct {
Topic string `protobuf:"bytes,1,opt,name=Topic,proto3" json:"Topic,omitempty"`
Qos int32 `protobuf:"varint,2,opt,name=Qos,proto3" json:"Qos,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *QueryShareSubscribeRequest) Reset() { *m = QueryShareSubscribeRequest{} }
func (m *QueryShareSubscribeRequest) String() string { return proto.CompactTextString(m) }
func (*QueryShareSubscribeRequest) ProtoMessage() {}
func (*QueryShareSubscribeRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_935f0990d4a84183, []int{3}
}
func (m *QueryShareSubscribeRequest) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_QueryShareSubscribeRequest.Unmarshal(m, b)
}
func (m *QueryShareSubscribeRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_QueryShareSubscribeRequest.Marshal(b, m, deterministic)
}
func (m *QueryShareSubscribeRequest) XXX_Merge(src proto.Message) {
xxx_messageInfo_QueryShareSubscribeRequest.Merge(m, src)
}
func (m *QueryShareSubscribeRequest) XXX_Size() int {
return xxx_messageInfo_QueryShareSubscribeRequest.Size(m)
}
func (m *QueryShareSubscribeRequest) XXX_DiscardUnknown() {
xxx_messageInfo_QueryShareSubscribeRequest.DiscardUnknown(m)
}
var xxx_messageInfo_QueryShareSubscribeRequest proto.InternalMessageInfo
func (m *QueryShareSubscribeRequest) GetTopic() string {
if m != nil {
return m.Topic
}
return ""
}
func (m *QueryShareSubscribeRequest) GetQos() int32 {
if m != nil {
return m.Qos
}
return 0
}
type Response struct {
RetCode int32 `protobuf:"varint,1,opt,name=RetCode,proto3" json:"RetCode,omitempty"`
Message string `protobuf:"bytes,2,opt,name=Message,proto3" json:"Message,omitempty"`
@@ -177,7 +224,7 @@ func (m *Response) Reset() { *m = Response{} }
func (m *Response) String() string { return proto.CompactTextString(m) }
func (*Response) ProtoMessage() {}
func (*Response) Descriptor() ([]byte, []int) {
return fileDescriptor_935f0990d4a84183, []int{3}
return fileDescriptor_935f0990d4a84183, []int{4}
}
func (m *Response) XXX_Unmarshal(b []byte) error {
@@ -212,34 +259,94 @@ func (m *Response) GetMessage() string {
return ""
}
type ShareSubscribeResponse struct {
RetCode int32 `protobuf:"varint,1,opt,name=RetCode,proto3" json:"RetCode,omitempty"`
Message string `protobuf:"bytes,2,opt,name=Message,proto3" json:"Message,omitempty"`
ShareSubCount int32 `protobuf:"varint,3,opt,name=ShareSubCount,proto3" json:"ShareSubCount,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *ShareSubscribeResponse) Reset() { *m = ShareSubscribeResponse{} }
func (m *ShareSubscribeResponse) String() string { return proto.CompactTextString(m) }
func (*ShareSubscribeResponse) ProtoMessage() {}
func (*ShareSubscribeResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_935f0990d4a84183, []int{5}
}
func (m *ShareSubscribeResponse) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_ShareSubscribeResponse.Unmarshal(m, b)
}
func (m *ShareSubscribeResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_ShareSubscribeResponse.Marshal(b, m, deterministic)
}
func (m *ShareSubscribeResponse) XXX_Merge(src proto.Message) {
xxx_messageInfo_ShareSubscribeResponse.Merge(m, src)
}
func (m *ShareSubscribeResponse) XXX_Size() int {
return xxx_messageInfo_ShareSubscribeResponse.Size(m)
}
func (m *ShareSubscribeResponse) XXX_DiscardUnknown() {
xxx_messageInfo_ShareSubscribeResponse.DiscardUnknown(m)
}
var xxx_messageInfo_ShareSubscribeResponse proto.InternalMessageInfo
func (m *ShareSubscribeResponse) GetRetCode() int32 {
if m != nil {
return m.RetCode
}
return 0
}
func (m *ShareSubscribeResponse) GetMessage() string {
if m != nil {
return m.Message
}
return ""
}
func (m *ShareSubscribeResponse) GetShareSubCount() int32 {
if m != nil {
return m.ShareSubCount
}
return 0
}
func init() {
proto.RegisterType((*QuerySubscribeRequest)(nil), "QuerySubscribeRequest")
proto.RegisterType((*QueryConnectRequest)(nil), "QueryConnectRequest")
proto.RegisterType((*DeliverMessageRequest)(nil), "DeliverMessageRequest")
proto.RegisterType((*QueryShareSubscribeRequest)(nil), "QueryShareSubscribeRequest")
proto.RegisterType((*Response)(nil), "Response")
proto.RegisterType((*ShareSubscribeResponse)(nil), "ShareSubscribeResponse")
}
func init() { proto.RegisterFile("hmq.proto", fileDescriptor_935f0990d4a84183) }
var fileDescriptor_935f0990d4a84183 = []byte{
// 263 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x91, 0x41, 0x4b, 0xc3, 0x40,
0x10, 0x85, 0x8d, 0x25, 0xda, 0x0c, 0xa5, 0xc8, 0xda, 0x96, 0xd0, 0x53, 0xc9, 0xa9, 0xa7, 0x85,
0x2a, 0xbd, 0xea, 0x21, 0x3d, 0xe8, 0xa1, 0x60, 0xb6, 0x5e, 0x3c, 0x26, 0xe9, 0xa0, 0x0b, 0x31,
0x93, 0xee, 0x6e, 0x0a, 0xfd, 0x51, 0xfe, 0x47, 0xc9, 0x9a, 0x55, 0x03, 0x81, 0xde, 0xf2, 0x11,
0xde, 0x7b, 0xc3, 0xb7, 0x10, 0x7c, 0x7c, 0x1e, 0x78, 0xa5, 0xc8, 0x50, 0xf4, 0x08, 0xd3, 0xa4,
0x46, 0x75, 0xda, 0xd5, 0x99, 0xce, 0x95, 0xcc, 0x50, 0xe0, 0xa1, 0x46, 0x6d, 0xd8, 0x04, 0xfc,
0x57, 0xa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1, 0xc6, 0xca, 0xd5, 0xe1, 0x46, 0x96, 0x27, 0x75, 0xff, 0xca,
0xeb, 0x72, 0x23, 0xa9, 0x84, 0xd1, 0xef, 0x02, 0xc7, 0xa7, 0x91, 0x1b, 0x38, 0x37, 0x69, 0xbe,
0x28, 0x32, 0x5d, 0xef, 0x6b, 0xff, 0xbc, 0xfd, 0x70, 0x00, 0x1e, 0x97, 0xc1, 0x0a, 0xe5, 0x2e,
0x89, 0x91, 0xcc, 0xa1, 0x6f, 0x73, 0x25, 0x23, 0xd6, 0x08, 0xda, 0x73, 0x99, 0x69, 0x47, 0x5b,
0x64, 0x06, 0xbd, 0x9f, 0x34, 0xc9, 0x80, 0x35, 0xc0, 0xb5, 0x2d, 0x73, 0xe8, 0xdb, 0x34, 0xc9,
0x88, 0x35, 0xe2, 0xb5, 0x6d, 0xcb, 0xfa, 0xdd, 0xd8, 0x17, 0x45, 0xae, 0xd9, 0xdf, 0xfc, 0xbc,
0x2b, 0xd6, 0x7c, 0xad, 0xb4, 0x15, 0x9d, 0x56, 0xcf, 0xf9, 0xee, 0x33, 0x00, 0x00, 0xff, 0xff,
0x82, 0x90, 0x64, 0x25, 0xdb, 0x02, 0x00, 0x00,
}
// Reference imports to suppress errors if they are not otherwise used.
@@ -257,6 +364,7 @@ type HMQServiceClient interface {
QuerySubscribe(ctx context.Context, in *QuerySubscribeRequest, opts ...grpc.CallOption) (*Response, error)
QueryConnect(ctx context.Context, in *QueryConnectRequest, opts ...grpc.CallOption) (*Response, error)
DeliverMessage(ctx context.Context, in *DeliverMessageRequest, opts ...grpc.CallOption) (*Response, error)
QueryShareSubscribe(ctx context.Context, in *QueryShareSubscribeRequest, opts ...grpc.CallOption) (*ShareSubscribeResponse, error)
}
type hMQServiceClient struct {
@@ -294,11 +402,21 @@ func (c *hMQServiceClient) DeliverMessage(ctx context.Context, in *DeliverMessag
return out, nil
}
func (c *hMQServiceClient) QueryShareSubscribe(ctx context.Context, in *QueryShareSubscribeRequest, opts ...grpc.CallOption) (*ShareSubscribeResponse, error) {
out := new(ShareSubscribeResponse)
err := c.cc.Invoke(ctx, "/HMQService/QueryShareSubscribe", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
// HMQServiceServer is the server API for HMQService service.
type HMQServiceServer interface {
QuerySubscribe(context.Context, *QuerySubscribeRequest) (*Response, error)
QueryConnect(context.Context, *QueryConnectRequest) (*Response, error)
DeliverMessage(context.Context, *DeliverMessageRequest) (*Response, error)
QueryShareSubscribe(context.Context, *QueryShareSubscribeRequest) (*ShareSubscribeResponse, error)
}
// UnimplementedHMQServiceServer can be embedded to have forward compatible implementations.
@@ -314,6 +432,9 @@ func (*UnimplementedHMQServiceServer) QueryConnect(ctx context.Context, req *Que
func (*UnimplementedHMQServiceServer) DeliverMessage(ctx context.Context, req *DeliverMessageRequest) (*Response, error) {
return nil, status.Errorf(codes.Unimplemented, "method DeliverMessage not implemented")
}
func (*UnimplementedHMQServiceServer) QueryShareSubscribe(ctx context.Context, req *QueryShareSubscribeRequest) (*ShareSubscribeResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method QueryShareSubscribe not implemented")
}
func RegisterHMQServiceServer(s *grpc.Server, srv HMQServiceServer) {
s.RegisterService(&_HMQService_serviceDesc, srv)
@@ -373,6 +494,24 @@ func _HMQService_DeliverMessage_Handler(srv interface{}, ctx context.Context, de
return interceptor(ctx, in, info, handler)
}
func _HMQService_QueryShareSubscribe_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(QueryShareSubscribeRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(HMQServiceServer).QueryShareSubscribe(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/HMQService/QueryShareSubscribe",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(HMQServiceServer).QueryShareSubscribe(ctx, req.(*QueryShareSubscribeRequest))
}
return interceptor(ctx, in, info, handler)
}
var _HMQService_serviceDesc = grpc.ServiceDesc{
ServiceName: "HMQService",
HandlerType: (*HMQServiceServer)(nil),
@@ -389,6 +528,10 @@ var _HMQService_serviceDesc = grpc.ServiceDesc{
MethodName: "DeliverMessage",
Handler: _HMQService_DeliverMessage_Handler,
},
{
MethodName: "QueryShareSubscribe",
Handler: _HMQService_QueryShareSubscribe_Handler,
},
},
Streams: []grpc.StreamDesc{},
Metadata: "hmq.proto",
+12
View File
@@ -15,14 +15,26 @@ message DeliverMessageRequest {
int32 Qos = 3;
}
message QueryShareSubscribeRequest {
string Topic = 1;
int32 Qos = 2;
}
message Response {
int32 RetCode = 1;
string Message = 2;
}
message ShareSubscribeResponse {
int32 RetCode = 1;
string Message = 2;
int32 ShareSubCount = 3;
}
//Service define
service HMQService {
rpc QuerySubscribe(QuerySubscribeRequest) returns (Response) {}
rpc QueryConnect(QueryConnectRequest) returns (Response) {}
rpc DeliverMessage(DeliverMessageRequest) returns (Response) {}
rpc QueryShareSubscribe(QueryShareSubscribeRequest) returns (ShareSubscribeResponse) {}
}