PHP Class DoraRPC\Client

Mostra file Open project: xcl3721/dora-rpc

Public Methods

Method Description
__construct ( $serverConfig )
__destruct ( )
changeMode ( $param ) 更换连接模式,用于指定ip请求和普通请求切换
clearAsyncData ( ) clean up the async list and result
getAsyncData ( )
getConnectMode ( ) : array 返回当前连接模式及相关信息
getStat ( string $ip = "", string $port = "" ) : array 获取应用服务器信息 get the backend service stat
multiAPI ( array $params, integer $mode = DoraConst::SW_MODE_WAITRESULT, integer $retry, string $ip = "", string $port = "" ) : mixed 并发请求api,使用方法如 $params = array( "api_1117"=>array("name"=>"apiname1",“param”=>array("id"=>1117)), "api_2"=>array("name"=>"apiname2","param"=>array("id"=>2)), )
reloadServerTask ( $ip = "", $port = "" )
singleAPI ( string $name, array $param, integer $mode = DoraConst::SW_MODE_WAITRESULT, integer $retry, string $ip = "", string $port = "" ) : mixed 单api请求

Private Methods

Method Description
doRequest ( $sendData, $type )
generateGuid ( )
getClientObj ( ) get current client
getConfigObjKey ( ) random get config key
waitResult ( $client ) return the right guid request

Method Details

__construct() public method

public __construct ( $serverConfig )

__destruct() public method

public __destruct ( )

changeMode() public method

更换连接模式,用于指定ip请求和普通请求切换
public changeMode ( $param )
$param

clearAsyncData() public method

clean up the async list and result
public clearAsyncData ( )

getAsyncData() public method

public getAsyncData ( )

getConnectMode() public method

返回当前连接模式及相关信息
public getConnectMode ( ) : array
return array

getStat() public method

获取应用服务器信息 get the backend service stat
public getStat ( string $ip = "", string $port = "" ) : array
$ip string
$port string
return array

multiAPI() public method

并发请求api,使用方法如 $params = array( "api_1117"=>array("name"=>"apiname1",“param”=>array("id"=>1117)), "api_2"=>array("name"=>"apiname2","param"=>array("id"=>2)), )
public multiAPI ( array $params, integer $mode = DoraConst::SW_MODE_WAITRESULT, integer $retry, string $ip = "", string $port = "" ) : mixed
$params array 提交参数 请指定key好方便区分对应结果,注意考虑到硬件资源有限并发请求不要超过50个
$mode integer
$retry integer 通讯错误时重试次数
$ip string 要连得ip地址,如果不指定从现有配置随机个
$port string 要连得port地址,如果不指定从现有配置找一个
return mixed 返回指定key结果

reloadServerTask() public method

public reloadServerTask ( $ip = "", $port = "" )

singleAPI() public method

单api请求
public singleAPI ( string $name, array $param, integer $mode = DoraConst::SW_MODE_WAITRESULT, integer $retry, string $ip = "", string $port = "" ) : mixed
$name string api地址
$param array 参数
$mode integer
$retry integer 通讯错误时重试次数
$ip string 要连得ip地址,如果不指定从现有配置随机个
$port string 要连得port地址,如果不指定从现有配置找一个
return mixed 返回单个请求结果