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
- config ClientConfiguration? ()
-
- The
grpc:ClientConfiguration
of the endpoint
- The
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
grpc:Error? result = grpcClient.initStub(self, "blocking", ROOT_DESCRIPTOR, getDescriptorMap());
blockingExecute
(string methodID, anydata payload, Headers? headers)
returns [anydata, Headers] | Error [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
()
nonBlockingExecute
(string methodID, anydata payload, service listenerService, Headers? headers)
returns Error? 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 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 descriptorMap)
returns Error? grpc:Error? result = grpcClient.initStub(self, "blocking", ROOT_DESCRIPTOR, getDescriptorMap());
Parameters
- clientEndpoint AbstractClientEndpoint
-
Client endpoint
- stubType string
-
Service Stub type. Possible values: blocking, nonblocking
- descriptorKey string
-
Key of the proto descriptor
- descriptorMap map
-
Proto descriptor map with all the dependent descriptors
-
Return Type
(Error?) A
grpc:Error
if an error occurs while initializing the stub or else()