Documentation ¶
Index ¶
- Constants
- Variables
- func NewAMQPClient(info *conf.Rabbitmq) (client *amqpClient, err error)
- func NewAMQPServer(info *conf.Rabbitmq, call_chan chan rpc.CallInfo) (*amqpServer, error)
- func NewLocalClient(server rpc.LocalServer) (*localClient, error)
- func NewLocalServer(call_chan chan rpc.CallInfo) (*localServer, error)
- func NewRPCClient(app module.AppInterface, serverId string) (rpc.RPCClient, error)
- func NewRPCServer(app module.AppInterface, module module.Module) (rpc.RPCServer, error)
- func NewRedisClient(info *conf.Redis) (client *redisClient, err error)
- func NewRedisServer(info *conf.Redis, call_chan chan rpc.CallInfo) (*redisServer, error)
- type ClientCallInfo
- type Error
- type RPCServer
- func (s *RPCServer) Done() (err error)
- func (this *RPCServer) Finish()
- func (s *RPCServer) GetExecuting() int64
- func (s *RPCServer) GetLocalRpcServer() rpc.LocalServer
- func (s *RPCServer) NewRabbitmqRpcServer(info *conf.Rabbitmq) (err error)
- func (s *RPCServer) NewRedisRpcServer(info *conf.Redis) (err error)
- func (s *RPCServer) Register(id string, fn interface{})
- func (s *RPCServer) RegisterGo(id string, fn interface{})
- func (s *RPCServer) SetGoroutineControl(control rpc.GoroutineControl)
- func (s *RPCServer) SetListener(listener rpc.RPCListener)
- func (this *RPCServer) Wait() error
- type RabbitAgent
- func (this *RabbitAgent) CallbackQueue() (string, error)
- func (this *RabbitAgent) ClientPublish(body []byte) error
- func (this *RabbitAgent) Closed() bool
- func (this *RabbitAgent) ExchangeDeclare() error
- func (this *RabbitAgent) Queue() error
- func (this *RabbitAgent) RChannel() (*amqp.Channel, error)
- func (this *RabbitAgent) RConnect() error
- func (this *RabbitAgent) ReadMsg() chan amqp.Delivery
- func (this *RabbitAgent) ServerPublish(queueName string, body []byte) error
- func (this *RabbitAgent) Shutdown() error
- func (this *RabbitAgent) WChannel() (*amqp.Channel, error)
- func (this *RabbitAgent) WConnect() error
Constants ¶
View Source
const ( ClientError = -1000 ClientParamNotAdapted = -1 ClientFormatError = -2 //ClientSuccess = -3 //client independence ClientUnAuthenticated = -100 ServerError = 1000 ServerParamMiss = -ClientParamNotAdapted ServerFormatError = -ClientFormatError //ServerSuccess = -ClientSuccess //server independence ServerDBError = 100 ServerRpcInvokeError = 101 ServerExpired = 102 )
Variables ¶
View Source
var ( // ErrParamsMiss is returned when client miss some params to invoke rpc ErrClientParamsMiss = &Error{Code: ClientParamNotAdapted, Reason: "client miss some params to invoke rpc"} // ErrParamsMiss is returned when client miss some params to invoke rpc ErrClientFormatError = &Error{Code: ClientFormatError, Reason: "client params format error"} // ErrParamsMiss is returned when client miss some params to invoke rpc ErrClientUnAuthenticated = &Error{Code: ClientUnAuthenticated, Reason: "client is unauthenticated"} // ErrParamsMiss is returned when client miss some params to invoke rpc ErrServerParamMiss = &Error{Code: ServerParamMiss, Reason: "server miss some params to invoke rpc"} // ErrParamsMiss is returned when client miss some params to invoke rpc ErrServerFormatError = &Error{Code: ServerFormatError, Reason: "server params format error"} // ErrParamsMiss is returned when client miss some params to invoke rpc ErrServerDBError = &Error{Code: ServerDBError, Reason: "server db error"} )
View Source
var ( TypeServer = 0 TypeClient = 1 )
Functions ¶
func NewAMQPClient ¶
func NewAMQPServer ¶
func NewLocalClient ¶
func NewLocalClient(server rpc.LocalServer) (*localClient, error)
这里是暴露整个Local server还是只暴露local server的mq_chan呢 因为是本地,暂时暴露整个local server也是OK的
func NewLocalServer ¶
func NewRPCClient ¶
func NewRPCServer ¶
func NewRedisClient ¶
Types ¶
type ClientCallInfo ¶
type ClientCallInfo struct {
// contains filtered or unexported fields
}
type Error ¶
type Error struct { Code int // constant code from the specification Reason string // description of the error }
Error captures the code and reason a channel or connection has been closed by the server.
type RPCServer ¶
type RPCServer struct {
// contains filtered or unexported fields
}
func (*RPCServer) GetExecuting ¶
func (*RPCServer) GetLocalRpcServer ¶
func (s *RPCServer) GetLocalRpcServer() rpc.LocalServer
func (*RPCServer) NewRabbitmqRpcServer ¶
create remote rpc service
func (*RPCServer) NewRedisRpcServer ¶
create redis rpc service
func (*RPCServer) RegisterGo ¶
func (*RPCServer) SetGoroutineControl ¶
func (s *RPCServer) SetGoroutineControl(control rpc.GoroutineControl)
func (*RPCServer) SetListener ¶
func (s *RPCServer) SetListener(listener rpc.RPCListener)
type RabbitAgent ¶
type RabbitAgent struct {
// contains filtered or unexported fields
}
func NewRabbitAgent ¶
func NewRabbitAgent(info *conf.Rabbitmq, serverType int) (*RabbitAgent, error)
func (*RabbitAgent) CallbackQueue ¶
func (this *RabbitAgent) CallbackQueue() (string, error)
* 创建回调 提供给 rpc client调用
func (*RabbitAgent) ClientPublish ¶
func (this *RabbitAgent) ClientPublish(body []byte) error
* rpc client写数据
func (*RabbitAgent) Closed ¶
func (this *RabbitAgent) Closed() bool
func (*RabbitAgent) ExchangeDeclare ¶
func (this *RabbitAgent) ExchangeDeclare() error
* 声明一个交换器,提供给rpc server端调用
func (*RabbitAgent) ReadMsg ¶
func (this *RabbitAgent) ReadMsg() chan amqp.Delivery
func (*RabbitAgent) ServerPublish ¶
func (this *RabbitAgent) ServerPublish(queueName string, body []byte) error
* rpc server写数据
Click to show internal directories.
Click to hide internal directories.