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 a blocking call with a gRPC service.

nonBlockingExecute

Calls when executing a non-blocking call with a gRPC service.

streamingExecute

Calls when executing a streaming call with a gRPC service.

Methods

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

blockingExecute

(string methodID, anydata payload, Headers? headers)

returns [anydata, Headers] | Error

Calls when executing a blocking call with a gRPC service.

 [anydata, grpc:Headers]|grpc:Error result = grpcClient->blockingExecute("HelloWorld/hello", req, headers);

Parameters

  • methodID string
  • Remote service method ID

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

  • headers Headers? (default ())
  • Optional headers parameter. The header value are passed only if needed. The default value is ()

  • Return Type

    ([anydata, Headers] | Error)
  • The response message and headers if executed successfully or else a grpc:Error

nonBlockingExecute

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

returns Error?

Calls when executing a non-blocking call with a gRPC service.

 grpc:Error? result = grpcClient->nonBlockingExecute("HelloWorld/hello", req, msgListener, headers);

Parameters

  • methodID string
  • Remote service method ID

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

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

  • headers Headers? (default ())
  • Optional headers parameter. The header values are passed only if needed. The default value is ()

  • Return Type

    (Error?)
  • A grpc:Error if an error occurs while sending the request or else ()

streamingExecute

(string methodID, service listenerService, Headers? headers)

returns StreamingClient | Error

Calls when executing a streaming call with a gRPC service.

 grpc:StreamingClient|grpc:Error result = grpcClient->streamingExecute("HelloWorld/lotsOfGreetings", msgListener, headers);

Parameters

  • methodID string
  • Remote service method ID

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

  • headers Headers? (default ())
  • Optional headers parameter. The header values are passed only if needed. The default value is ()

  • Return Type

    (StreamingClient | Error)
  • A grpc:StreamingClient object if executed successfully or else ()

initStub

(AbstractClientEndpoint clientEndpoint, string stubType, string descriptorKey, map<any> descriptorMap)

returns Error?

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

 grpc:Error? result = grpcClient.initStub(self, "blocking", ROOT_DESCRIPTOR, getDescriptorMap());

Parameters

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

  • descriptorKey string
  • Key of the proto descriptor

  • descriptorMap map<any>
  • Proto descriptor map with all the dependent descriptors

  • Return Type

    (Error?)
  • A grpc:Error if an error occurs while initializing the stub or else ()