How to call gRPC functions
Open Workflow defines call: grpc. Lemline registers such a definition, but it has no gRPC executor yet: an instance faults at the gRPC task with Unknown task type: CallGRPC. The examples below describe a stock service of the tutorial shop that exists only as an illustration: the shop has no gRPC server. Until Lemline supports gRPC, call an HTTP equivalent of the service, as shown at the end of this page. See Supported Features.
To check the registration, complete the SQLite setup, keep its worker running and use a second terminal in the setup directory. With the JAR, substitute java -jar lemline.jar for bin/lemline.
Define a unary call
Identify the protobuf resource, service and method. Set arguments to the request message fields.
Save it as basic-grpc-call.yaml:
The definition registers. The instance faults with a runtime error titled Unknown task type: CallGRPC.
Configure authentication
Attach a policy to the service where the executing runtime supports it. This one sends a bearer token read from the apiToken secret:
Save it as example-using-authentication.yaml. Register it to check the definition; it cannot run on Lemline either:
Call an HTTP equivalent
Start the tutorial shop from the root of the Lemline source checkout. Its product endpoint returns the same stock information over HTTP:
Save it as alternative.yaml:
The instance completes with the product and its stock, {"id":"SKU-1","name":"Garden hose","category":"garden","price":25,"available":100}. Stop the shop when you are done:
See the gRPC Task for configuration fields.