Documentation ¶
Overview ¶
Copyright 2014 mqant Author. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright 2014 mqant Author. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright 2014 mqant Author. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright 2014 mqant Author. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright 2014 mqant Author. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright 2014 mqant Author. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright 2014 mqant Author. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright 2014 mqant Author. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright 2014 mqant Author. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright 2014 mqant Author. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright 2014 mqant Author. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright 2014 mqant Author. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Index ¶
- Variables
- func NewRPCClient(app module.App, serverId string) (mqrpc.RPCClient, error)
- func NewRPCServer(app module.App, module module.Module) (mqrpc.RPCServer, error)
- type AMQPClient
- func (c *AMQPClient) Call(callInfo mqrpc.CallInfo, callback chan rpcpb.ResultInfo) error
- func (c *AMQPClient) CallNR(callInfo mqrpc.CallInfo) error
- func (c *AMQPClient) Done() (err error)
- func (c *AMQPClient) Marshal(rpcInfo *rpcpb.RPCInfo) ([]byte, error)
- func (c *AMQPClient) Unmarshal(data []byte) (*rpcpb.RPCInfo, error)
- func (c *AMQPClient) UnmarshalResult(data []byte) (*rpcpb.ResultInfo, error)
- type AMQPServer
- type ClinetCallInfo
- type Consumer
- type LocalClient
- type LocalServer
- func (s *LocalServer) Callback(callinfo mqrpc.CallInfo) error
- func (s *LocalServer) IsClose() bool
- func (s *LocalServer) SafeCallback(local_chan chan rpcpb.ResultInfo, callInfo rpcpb.ResultInfo) (closed bool)
- func (s *LocalServer) SafeSend(local_chan chan mqrpc.CallInfo, callInfo mqrpc.CallInfo) (closed bool)
- func (s *LocalServer) Shutdown() (err error)
- func (s *LocalServer) StopConsume() error
- func (s *LocalServer) Write(callInfo mqrpc.CallInfo) error
- type RPCClient
- func (c *RPCClient) Call(_func string, params ...interface{}) (interface{}, string)
- func (c *RPCClient) CallArgs(_func string, ArgsType []string, args [][]byte) (interface{}, string)
- func (c *RPCClient) CallNR(_func string, params ...interface{}) (err error)
- func (c *RPCClient) CallNRArgs(_func string, ArgsType []string, args [][]byte) (err error)
- func (c *RPCClient) Done() (err error)
- func (c *RPCClient) NewLocalClient(server mqrpc.RPCServer) (err error)
- func (c *RPCClient) NewRabbitmqClient(info *conf.Rabbitmq) (err error)
- func (c *RPCClient) NewRedisClient(info *conf.Redis) (err error)
- func (c *RPCClient) NewUdpClient(info *conf.UDP) (err error)
- type RPCServer
- func (s *RPCServer) Done() (err error)
- func (this *RPCServer) Finish()
- func (s *RPCServer) GetExecuting() int64
- func (s *RPCServer) GetLocalServer() mqrpc.LocalServer
- func (s *RPCServer) NewRabbitmqRPCServer(info *conf.Rabbitmq) (err error)
- func (s *RPCServer) NewRedisRPCServer(info *conf.Redis) (err error)
- func (s *RPCServer) NewUdpRPCServer(info *conf.UDP) (err error)
- func (s *RPCServer) Register(id string, f interface{})
- func (s *RPCServer) RegisterGO(id string, f interface{})
- func (s *RPCServer) SetGoroutineControl(control mqrpc.GoroutineControl)
- func (s *RPCServer) SetListener(listener mqrpc.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
- type RabbitMQInfo
- type RedisClient
- func (c *RedisClient) Call(callInfo mqrpc.CallInfo, callback chan rpcpb.ResultInfo) error
- func (c *RedisClient) CallNR(callInfo mqrpc.CallInfo) error
- func (c *RedisClient) Done() (err error)
- func (this *RedisClient) Finish()
- func (c *RedisClient) Marshal(rpcInfo *rpcpb.RPCInfo) ([]byte, error)
- func (c *RedisClient) Unmarshal(data []byte) (*rpcpb.RPCInfo, error)
- func (c *RedisClient) UnmarshalResult(data []byte) (*rpcpb.ResultInfo, error)
- func (this *RedisClient) Wait() error
- type RedisServer
- type UDPClient
- func (this *UDPClient) Call(callInfo mqrpc.CallInfo, callback chan rpcpb.ResultInfo) (err error)
- func (this *UDPClient) CallNR(callInfo mqrpc.CallInfo) (err error)
- func (c *UDPClient) Done() error
- func (this *UDPClient) GetConn() (*net.UDPConn, error)
- func (c *UDPClient) Marshal(rpcInfo *rpcpb.RPCInfo) ([]byte, error)
- func (c *UDPClient) Unmarshal(data []byte) (*rpcpb.RPCInfo, error)
- func (c *UDPClient) UnmarshalResult(data []byte) (*rpcpb.ResultInfo, error)
- type UDPServer
Constants ¶
This section is empty.
Variables ¶
var ( TypeServer = 0 TypeClient = 1 )
Functions ¶
Types ¶
type AMQPClient ¶
type AMQPClient struct {
// contains filtered or unexported fields
}
func NewAMQPClient ¶
func NewAMQPClient(info *conf.Rabbitmq) (client *AMQPClient, err error)
func (*AMQPClient) Call ¶
func (c *AMQPClient) Call(callInfo mqrpc.CallInfo, callback chan rpcpb.ResultInfo) error
* 消息请求
func (*AMQPClient) Done ¶
func (c *AMQPClient) Done() (err error)
func (*AMQPClient) Marshal ¶
func (c *AMQPClient) Marshal(rpcInfo *rpcpb.RPCInfo) ([]byte, error)
goroutine safe
func (*AMQPClient) Unmarshal ¶
func (c *AMQPClient) Unmarshal(data []byte) (*rpcpb.RPCInfo, error)
func (*AMQPClient) UnmarshalResult ¶
func (c *AMQPClient) UnmarshalResult(data []byte) (*rpcpb.ResultInfo, error)
type AMQPServer ¶
type AMQPServer struct {
// contains filtered or unexported fields
}
func NewAMQPServer ¶
func NewAMQPServer(info *conf.Rabbitmq, call_chan chan mqrpc.CallInfo) (*AMQPServer, error)
func (*AMQPServer) Callback ¶
func (s *AMQPServer) Callback(callinfo mqrpc.CallInfo) error
func (*AMQPServer) MarshalResult ¶
func (s *AMQPServer) MarshalResult(resultInfo rpcpb.ResultInfo) ([]byte, error)
goroutine safe
func (*AMQPServer) Unmarshal ¶
func (s *AMQPServer) Unmarshal(data []byte) (*rpcpb.RPCInfo, error)
type ClinetCallInfo ¶
type ClinetCallInfo struct {
// contains filtered or unexported fields
}
type Consumer ¶
type Consumer struct {
// contains filtered or unexported fields
}
func NewConsumer ¶
type LocalClient ¶
type LocalClient struct {
// contains filtered or unexported fields
}
func NewLocalClient ¶
func NewLocalClient(server mqrpc.LocalServer) (*LocalClient, error)
func (*LocalClient) Call ¶
func (c *LocalClient) Call(callInfo mqrpc.CallInfo, callback chan rpcpb.ResultInfo) (err error)
* 消息请求
func (*LocalClient) CallNR ¶
func (c *LocalClient) CallNR(callInfo mqrpc.CallInfo) (err error)
* 消息请求 不需要回复
func (*LocalClient) Done ¶
func (c *LocalClient) Done() error
type LocalServer ¶
type LocalServer struct {
// contains filtered or unexported fields
}
func NewLocalServer ¶
func NewLocalServer(call_chan chan mqrpc.CallInfo) (*LocalServer, error)
func (*LocalServer) SafeCallback ¶
func (s *LocalServer) SafeCallback(local_chan chan rpcpb.ResultInfo, callInfo rpcpb.ResultInfo) (closed bool)
func (*LocalServer) SafeSend ¶
func (s *LocalServer) SafeSend(local_chan chan mqrpc.CallInfo, callInfo mqrpc.CallInfo) (closed bool)
type RPCClient ¶
type RPCClient struct {
// contains filtered or unexported fields
}
func (*RPCClient) CallNRArgs ¶
func (*RPCClient) NewLocalClient ¶
func (*RPCClient) NewRabbitmqClient ¶
type RPCServer ¶
type RPCServer struct {
// contains filtered or unexported fields
}
func (*RPCServer) GetLocalServer ¶
func (s *RPCServer) GetLocalServer() mqrpc.LocalServer
func (*RPCServer) NewRabbitmqRPCServer ¶
* 创建一个支持远程RPC的服务
func (*RPCServer) NewRedisRPCServer ¶
* 创建一个支持远程Redis RPC的服务
func (*RPCServer) NewUdpRPCServer ¶ added in v1.8.0
* 创建一个支持远程UDP RPC的服务
func (*RPCServer) RegisterGO ¶
you must call the function before calling Open and Go
func (*RPCServer) SetGoroutineControl ¶
func (s *RPCServer) SetGoroutineControl(control mqrpc.GoroutineControl)
func (*RPCServer) SetListener ¶
func (s *RPCServer) SetListener(listener mqrpc.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写数据
type RabbitMQInfo ¶
type RabbitMQInfo struct {
// contains filtered or unexported fields
}
type RedisClient ¶
type RedisClient struct {
// contains filtered or unexported fields
}
func NewRedisClient ¶
func NewRedisClient(info *conf.Redis) (client *RedisClient, err error)
func (*RedisClient) Call ¶
func (c *RedisClient) Call(callInfo mqrpc.CallInfo, callback chan rpcpb.ResultInfo) error
* 消息请求
func (*RedisClient) CallNR ¶
func (c *RedisClient) CallNR(callInfo mqrpc.CallInfo) error
* 消息请求 不需要回复
func (*RedisClient) Done ¶
func (c *RedisClient) Done() (err error)
func (*RedisClient) Finish ¶
func (this *RedisClient) Finish()
func (*RedisClient) Marshal ¶
func (c *RedisClient) Marshal(rpcInfo *rpcpb.RPCInfo) ([]byte, error)
goroutine safe
func (*RedisClient) Unmarshal ¶
func (c *RedisClient) Unmarshal(data []byte) (*rpcpb.RPCInfo, error)
func (*RedisClient) UnmarshalResult ¶
func (c *RedisClient) UnmarshalResult(data []byte) (*rpcpb.ResultInfo, error)
func (*RedisClient) Wait ¶
func (this *RedisClient) Wait() error
type RedisServer ¶
type RedisServer struct {
// contains filtered or unexported fields
}
func NewRedisServer ¶
func NewRedisServer(info *conf.Redis, call_chan chan mqrpc.CallInfo) (*RedisServer, error)
func (*RedisServer) Callback ¶
func (s *RedisServer) Callback(callinfo mqrpc.CallInfo) error
func (*RedisServer) MarshalResult ¶
func (s *RedisServer) MarshalResult(resultInfo rpcpb.ResultInfo) ([]byte, error)
goroutine safe
func (*RedisServer) Unmarshal ¶
func (s *RedisServer) Unmarshal(data []byte) (*rpcpb.RPCInfo, error)
type UDPClient ¶ added in v1.8.0
type UDPClient struct {
// contains filtered or unexported fields
}
func (*UDPClient) UnmarshalResult ¶ added in v1.8.0
type UDPServer ¶ added in v1.8.0
type UDPServer struct {
// contains filtered or unexported fields
}
func NewUdpServer ¶ added in v1.8.0
func (*UDPServer) MarshalResult ¶ added in v1.8.0
goroutine safe