rpcclient

package module
v0.0.0-...-3990634 Latest Latest
Warning

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

Go to latest
Published: Nov 9, 2016 License: MIT Imports: 16 Imported by: 0

README

RpcClient.go

RpcClient for Go RPC servers.

Installation

go get github.com/cgrates/rpcclient

Support

Join CGRateS on Google Groups here.

License

RpcClient.go is released under the MIT License.

Copyright (C) ITsysCOM GmbH. All Rights Reserved.

Documentation

Index

Constants

View Source
const (
	JSON_RPC       = "json"
	JSON_HTTP      = "http_jsonrpc"
	GOB_RPC        = "gob"
	INTERNAL_RPC   = "*internal"
	POOL_FIRST     = "first"
	POOL_RANDOM    = "random"
	POOL_NEXT      = "next"
	POOL_BROADCAST = "broadcast"
)

Variables

View Source
var (
	ErrReqUnsynchronized       = errors.New("REQ_UNSYNCHRONIZED")
	ErrUnsupporteServiceMethod = errors.New("UNSUPPORTED_SERVICE_METHOD")
	ErrWrongArgsType           = errors.New("WRONG_ARGS_TYPE")
	ErrWrongReplyType          = errors.New("WRONG_REPLY_TYPE")
	ErrDisconnected            = errors.New("DISCONNECTED")
	ErrReplyTimeout            = errors.New("REPLY_TIMEOUT")
	ErrFailedReconnect         = errors.New("FAILED_RECONNECT")
	ErrInternallyDisconnected  = errors.New("INTERNALLY_DISCONNECTED")
	ErrUnsupportedCodec        = errors.New("UNSUPPORTED_CODEC")
	ErrSessionNotFound         = errors.New("SESSION_NOT_FOUND")
)

Functions

func Fib

func Fib() func() time.Duration

successive Fibonacci numbers.

Types

type HttpJsonRpcClient

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

func (*HttpJsonRpcClient) Call

func (self *HttpJsonRpcClient) Call(serviceMethod string, args interface{}, reply interface{}) error

type JsonRpcResponse

type JsonRpcResponse struct {
	Id     uint64
	Result *json.RawMessage
	Error  interface{}
}

Response received for

type RpcClient

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

func NewRpcClient

func NewRpcClient(transport, addr string, connectAttempts, reconnects int, connTimeout, replyTimeout time.Duration, codec string, internalConn RpcClientConnection, lazyConnect bool) (rpcClient *RpcClient, err error)

func (*RpcClient) Call

func (self *RpcClient) Call(serviceMethod string, args interface{}, reply interface{}) (err error)

type RpcClientConnection

type RpcClientConnection interface {
	Call(string, interface{}, interface{}) error
}

Connection used in RpcClient, as interface so we can combine the rpc.RpcClient with http one or websocket

type RpcClientPool

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

func NewRpcClientPool

func NewRpcClientPool(transmissionType string, replyTimeout time.Duration) *RpcClientPool

func (*RpcClientPool) AddClient

func (pool *RpcClientPool) AddClient(rcc RpcClientConnection)

func (*RpcClientPool) Call

func (pool *RpcClientPool) Call(serviceMethod string, args interface{}, reply interface{}) (err error)

Jump to

Keyboard shortcuts

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