Clients - grpc : Client

The gRPC client endpoint provides the capability for initiating contact with a remote gRPC service. The API it provides includes functions to send request/error messages.

Constructor

__init

(string url, ClientConfiguration? config)

  • url string
  • The server url.

Remote Methods

blockingExecute

Calls when executing blocking call with gRPC service.

nonBlockingExecute

Calls when executing non-blocking call with gRPC service.

streamingExecute

Calls when executing streaming call with gRPC service.

Methods

blockingExecute

(string methodID, anydata payload, Headers? headers)

returns [anydata, Headers] | Error

Calls when executing blocking call with gRPC service.

Parameters

  • methodID string
  • Remote service method id.

  • payload anydata
  • Request message. Message type varies with remote service method parameter.

  • headers Headers? (default ())
  • Optional headers parameter. Passes header value if needed. Default sets to nil.

  • Return Type

    ([anydata, Headers] | Error)
  • Returns response message and headers if executes successfully, error otherwise.

nonBlockingExecute

(string methodID, anydata payload, service listenerService, Headers? headers)

returns Error?

Calls when executing non-blocking call with gRPC service.

Parameters

  • methodID string
  • Remote service method id.

  • payload anydata
  • Request message. Message type varies with remote service method parameter..

  • listenerService service
  • Call back listener service. This service listens the response message from service.

  • headers Headers? (default ())
  • Optional headers parameter. Passes header value if needed. Default sets to nil.

  • Return Type

    (Error?)
  • Returns an error if encounters an error while sending the request, returns nil otherwise.

streamingExecute

(string methodID, service listenerService, Headers? headers)

returns StreamingClient | Error

Calls when executing streaming call with gRPC service.

Parameters

  • methodID string
  • Remote service method id.

  • listenerService service
  • Call back listener service. This service listens the response message from service.

  • headers Headers? (default ())
  • Optional headers parameter. Passes header value if needed. Default sets to nil.

  • Return Type

    (StreamingClient | Error)
  • Returns client connection if executes successfully, error otherwise.

initStub

(AbstractClientEndpoint clientEndpoint, string stubType, string descriptorKey, map descriptorMap)

returns Error?

Calls when initializing client endpoint with service descriptor data extracted from proto file.

Parameters

  • stubType string
  • Service Stub type. possible values: blocking, nonblocking.

  • descriptorKey string
  • Proto descriptor key. Key of proto descriptor.

  • descriptorMap map
  • Proto descriptor map. descriptor map with all dependent descriptors.

  • Return Type

    (Error?)
  • Returns an error if encounters an error while initializing the stub, returns nill otherwise.