Options
All
  • Public
  • Public/Protected
  • All
Menu

Class RpcClient

RPC Client Class

Hierarchy

  • RpcClient

Index

Constructors

constructor

Properties

_context

_context: any

_routeContext

_routeContext: RouteContext

_station

_station: MailStation

Optional chParam

chParam: object

Type declaration

opts

proxies

proxies: Proxies

router

router: Router

routerType

routerType: string

rpcDebugLog

rpcDebugLog: boolean

state

state: number

Optional wrrParam

wrrParam: object

Type declaration

  • [serverType: string]: object
    • index: number
    • weight: number

Methods

addProxies

addProxy

  • Add a new proxy to the rpc client which would overrid the proxy under the same key.

    Parameters

    • record: RemoteServerCode

      proxy description record, format: {namespace, serverType, path}

    Returns void

addServer

addServers

after

before

filter

removeServer

  • removeServer(id: string | number): void
  • Remove remote server from the rpc client.

    Parameters

    • id: string | number

      server id

    Returns void

removeServers

  • removeServers(ids: Array<string | number>): void
  • Batch version for remove remote server.

    Parameters

    • ids: Array<string | number>

      remote server id list

    Returns void

replaceServers

rpcInvoke

  • rpcInvoke(serverId: string, msg: RpcMsg, cb: function): void
  • Do the rpc invoke directly.

    Parameters

    • serverId: string

      remote server id

    • msg: RpcMsg

      rpc message. Message format: {serverType: serverType, service: serviceName, method: methodName, args: arguments}

    • cb: function

      cb(err, ...)

        • (err: Error, ...args: any[]): void
        • Parameters

          • err: Error
          • Rest ...args: any[]

          Returns void

    Returns void

setErrorHandler

start

  • start(cb: function): void
  • Start the rpc client which would try to connect the remote servers and report the result by cb.

    Parameters

    • cb: function

      cb(err)

        • (err?: Error): void
        • Parameters

          • Optional err: Error

          Returns void

    Returns void

stop

  • stop(force: boolean): void