ccssdk

package module
v0.0.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 19, 2021 License: MIT Imports: 16 Imported by: 2

README

ccs-sdk

ccs sdk code

Documentation

Index

Constants

View Source
const (
	MQ_ENDPOINT   = "MQ_ENDPOINT"
	MQ_REQ_TOPIC  = "MQ_REQ_TOPIC"
	MQ_RESP_TOPIC = "MQ_RESP_TOPIC"
)

Variables

View Source
var File_message_proto protoreflect.FileDescriptor

Functions

func GetOrDefault added in v0.0.2

func GetOrDefault(key, def string) string

func RegisterServiceMessageServer added in v0.0.2

func RegisterServiceMessageServer(s *grpc.Server, srv ServiceMessageServer)

Types

type CcsSdk

type CcsSdk struct {
	HandleFuncs HandleFuncs
	// contains filtered or unexported fields
}

func InitCcsSdk

func InitCcsSdk(handleFuncs HandleFuncs) (*CcsSdk, error)

type EchoRequest added in v0.0.2

type EchoRequest struct {
	Str string `protobuf:"bytes,1,opt,name=str,proto3" json:"str,omitempty"`
	// contains filtered or unexported fields
}

func (*EchoRequest) Descriptor deprecated added in v0.0.2

func (*EchoRequest) Descriptor() ([]byte, []int)

Deprecated: Use EchoRequest.ProtoReflect.Descriptor instead.

func (*EchoRequest) GetStr added in v0.0.2

func (x *EchoRequest) GetStr() string

func (*EchoRequest) ProtoMessage added in v0.0.2

func (*EchoRequest) ProtoMessage()

func (*EchoRequest) ProtoReflect added in v0.0.2

func (x *EchoRequest) ProtoReflect() protoreflect.Message

func (*EchoRequest) Reset added in v0.0.2

func (x *EchoRequest) Reset()

func (*EchoRequest) String added in v0.0.2

func (x *EchoRequest) String() string

type EchoResponse added in v0.0.2

type EchoResponse struct {
	Str string `protobuf:"bytes,1,opt,name=str,proto3" json:"str,omitempty"`
	// contains filtered or unexported fields
}

func (*EchoResponse) Descriptor deprecated added in v0.0.2

func (*EchoResponse) Descriptor() ([]byte, []int)

Deprecated: Use EchoResponse.ProtoReflect.Descriptor instead.

func (*EchoResponse) GetStr added in v0.0.2

func (x *EchoResponse) GetStr() string

func (*EchoResponse) ProtoMessage added in v0.0.2

func (*EchoResponse) ProtoMessage()

func (*EchoResponse) ProtoReflect added in v0.0.2

func (x *EchoResponse) ProtoReflect() protoreflect.Message

func (*EchoResponse) Reset added in v0.0.2

func (x *EchoResponse) Reset()

func (*EchoResponse) String added in v0.0.2

func (x *EchoResponse) String() string

type HandleFunc added in v0.0.2

type HandleFunc func(MessageContext) error

func NewDefaultHandle added in v0.0.2

func NewDefaultHandle() HandleFunc

type HandleFuncs added in v0.0.2

type HandleFuncs []HandleFunc

func NewEmpty added in v0.0.2

func NewEmpty() HandleFuncs

type MessageContext added in v0.0.2

type MessageContext interface {
	GetAppId() string
	GetServiceId() string
	GetRespServiceId() string
	GetTimestamp() int64
	GetPayload() string
	GetReferers() []*interface{}
	GetCode() int32
}

type MessageContextImpl added in v0.0.2

type MessageContextImpl struct {
	AppId         string
	ServiceId     string
	RespServiceId string
	Timestamp     int64
	Payload       string
	Referers      []*interface{}
	Code          int32
}

func (MessageContextImpl) GetAppId added in v0.0.2

func (x MessageContextImpl) GetAppId() string

func (MessageContextImpl) GetCode added in v0.0.2

func (x MessageContextImpl) GetCode() int32

func (MessageContextImpl) GetPayload added in v0.0.2

func (x MessageContextImpl) GetPayload() string

func (MessageContextImpl) GetReferers added in v0.0.2

func (x MessageContextImpl) GetReferers() []*interface{}

func (MessageContextImpl) GetRespServiceId added in v0.0.2

func (x MessageContextImpl) GetRespServiceId() string

func (MessageContextImpl) GetServiceId added in v0.0.2

func (x MessageContextImpl) GetServiceId() string

func (MessageContextImpl) GetTimestamp added in v0.0.2

func (x MessageContextImpl) GetTimestamp() int64

type MessageQueueRepository added in v0.0.2

type MessageQueueRepository interface {
	Subscribe(topic string, funcs HandleFuncs)
}

type MessageQueueService added in v0.0.2

type MessageQueueService struct {
	Repo MessageQueueRepository
}

func NewMessageQueueService added in v0.0.2

func NewMessageQueueService(repo MessageQueueRepository) *MessageQueueService

func (*MessageQueueService) Subscribe added in v0.0.2

func (s *MessageQueueService) Subscribe(topic string, funcs HandleFuncs)

type MessageRequest added in v0.0.2

type MessageRequest struct {
	AppId            string     `protobuf:"bytes,1,opt,name=app_id,json=appId,proto3" json:"app_id,omitempty"`
	ServiceId        string     `protobuf:"bytes,2,opt,name=service_id,json=serviceId,proto3" json:"service_id,omitempty"`
	Token            string     `protobuf:"bytes,3,opt,name=token,proto3" json:"token,omitempty"`
	Timestamp        int64      `protobuf:"varint,4,opt,name=timestamp,proto3" json:"timestamp,omitempty"` // 最后一次被处理的时间戳
	Payload          string     `protobuf:"bytes,5,opt,name=payload,proto3" json:"payload,omitempty"`
	Referers         []*Referer `protobuf:"bytes,6,rep,name=referers,proto3" json:"referers,omitempty"`
	NeedRespReferers bool       `protobuf:"varint,7,opt,name=need_resp_referers,json=needRespReferers,proto3" json:"need_resp_referers,omitempty"`
	// contains filtered or unexported fields
}

请求消息类型

func (*MessageRequest) Descriptor deprecated added in v0.0.2

func (*MessageRequest) Descriptor() ([]byte, []int)

Deprecated: Use MessageRequest.ProtoReflect.Descriptor instead.

func (*MessageRequest) GetAppId added in v0.0.2

func (x *MessageRequest) GetAppId() string

func (*MessageRequest) GetNeedRespReferers added in v0.0.2

func (x *MessageRequest) GetNeedRespReferers() bool

func (*MessageRequest) GetPayload added in v0.0.2

func (x *MessageRequest) GetPayload() string

func (*MessageRequest) GetReferers added in v0.0.2

func (x *MessageRequest) GetReferers() []*Referer

func (*MessageRequest) GetServiceId added in v0.0.2

func (x *MessageRequest) GetServiceId() string

func (*MessageRequest) GetTimestamp added in v0.0.2

func (x *MessageRequest) GetTimestamp() int64

func (*MessageRequest) GetToken added in v0.0.2

func (x *MessageRequest) GetToken() string

func (*MessageRequest) ProtoMessage added in v0.0.2

func (*MessageRequest) ProtoMessage()

func (*MessageRequest) ProtoReflect added in v0.0.2

func (x *MessageRequest) ProtoReflect() protoreflect.Message

func (*MessageRequest) Reset added in v0.0.2

func (x *MessageRequest) Reset()

func (*MessageRequest) String added in v0.0.2

func (x *MessageRequest) String() string

type MessageResponse added in v0.0.2

type MessageResponse struct {
	AppId         string     `protobuf:"bytes,1,opt,name=app_id,json=appId,proto3" json:"app_id,omitempty"`
	ServiceId     string     `protobuf:"bytes,2,opt,name=service_id,json=serviceId,proto3" json:"service_id,omitempty"`
	RespServiceId string     `protobuf:"bytes,3,opt,name=resp_service_id,json=respServiceId,proto3" json:"resp_service_id,omitempty"`
	Timestamp     int64      `protobuf:"varint,4,opt,name=timestamp,proto3" json:"timestamp,omitempty"` // 最后一次被处理的时间戳
	Payload       string     `protobuf:"bytes,5,opt,name=payload,proto3" json:"payload,omitempty"`
	Referers      []*Referer `protobuf:"bytes,6,rep,name=referers,proto3" json:"referers,omitempty"`
	Code          int32      `protobuf:"varint,7,opt,name=code,proto3" json:"code,omitempty"`
	// contains filtered or unexported fields
}

返回消息类型

func (*MessageResponse) Descriptor deprecated added in v0.0.2

func (*MessageResponse) Descriptor() ([]byte, []int)

Deprecated: Use MessageResponse.ProtoReflect.Descriptor instead.

func (*MessageResponse) GetAppId added in v0.0.2

func (x *MessageResponse) GetAppId() string

func (*MessageResponse) GetCode added in v0.0.2

func (x *MessageResponse) GetCode() int32

func (*MessageResponse) GetPayload added in v0.0.2

func (x *MessageResponse) GetPayload() string

func (*MessageResponse) GetReferers added in v0.0.2

func (x *MessageResponse) GetReferers() []*Referer

func (*MessageResponse) GetRespServiceId added in v0.0.2

func (x *MessageResponse) GetRespServiceId() string

func (*MessageResponse) GetServiceId added in v0.0.2

func (x *MessageResponse) GetServiceId() string

func (*MessageResponse) GetTimestamp added in v0.0.2

func (x *MessageResponse) GetTimestamp() int64

func (*MessageResponse) ProtoMessage added in v0.0.2

func (*MessageResponse) ProtoMessage()

func (*MessageResponse) ProtoReflect added in v0.0.2

func (x *MessageResponse) ProtoReflect() protoreflect.Message

func (*MessageResponse) Reset added in v0.0.2

func (x *MessageResponse) Reset()

func (*MessageResponse) String added in v0.0.2

func (x *MessageResponse) String() string

type Referer added in v0.0.2

type Referer struct {
	Timestamp int64  `protobuf:"varint,1,opt,name=timestamp,proto3" json:"timestamp,omitempty"`
	Value     string `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"`
	// contains filtered or unexported fields
}

请求消息的引用类型

func (*Referer) Descriptor deprecated added in v0.0.2

func (*Referer) Descriptor() ([]byte, []int)

Deprecated: Use Referer.ProtoReflect.Descriptor instead.

func (*Referer) GetTimestamp added in v0.0.2

func (x *Referer) GetTimestamp() int64

func (*Referer) GetValue added in v0.0.2

func (x *Referer) GetValue() string

func (*Referer) ProtoMessage added in v0.0.2

func (*Referer) ProtoMessage()

func (*Referer) ProtoReflect added in v0.0.2

func (x *Referer) ProtoReflect() protoreflect.Message

func (*Referer) Reset added in v0.0.2

func (x *Referer) Reset()

func (*Referer) String added in v0.0.2

func (x *Referer) String() string

type RocketMQMessageQueueRepository added in v0.0.2

type RocketMQMessageQueueRepository struct {
	// contains filtered or unexported fields
}

func NewRocketMQMessageQueueRepository added in v0.0.2

func NewRocketMQMessageQueueRepository(nameServers []string, respTopic string) (*RocketMQMessageQueueRepository, error)

func (RocketMQMessageQueueRepository) Subscribe added in v0.0.2

func (r RocketMQMessageQueueRepository) Subscribe(topic string, funcs HandleFuncs)

type ServiceMessageClient added in v0.0.2

type ServiceMessageClient interface {
	OnMessageRequest(ctx context.Context, in *MessageRequest, opts ...grpc.CallOption) (*MessageResponse, error)
	OnEcho(ctx context.Context, in *EchoRequest, opts ...grpc.CallOption) (*EchoResponse, error)
}

ServiceMessageClient is the client API for ServiceMessage service.

For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.

func NewServiceMessageClient added in v0.0.2

func NewServiceMessageClient(cc grpc.ClientConnInterface) ServiceMessageClient

type ServiceMessageServer added in v0.0.2

type ServiceMessageServer interface {
	OnMessageRequest(context.Context, *MessageRequest) (*MessageResponse, error)
	OnEcho(context.Context, *EchoRequest) (*EchoResponse, error)
}

ServiceMessageServer is the server API for ServiceMessage service.

type UnimplementedServiceMessageServer added in v0.0.2

type UnimplementedServiceMessageServer struct {
}

UnimplementedServiceMessageServer can be embedded to have forward compatible implementations.

func (*UnimplementedServiceMessageServer) OnEcho added in v0.0.2

func (*UnimplementedServiceMessageServer) OnMessageRequest added in v0.0.2

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL