Designer 10.15 | webMethods Service Development Help | Working with gRPC Descriptors | Editing a gRPC Method Flow Service
 
Editing a gRPC Method Flow Service
A gRPC method flow service contains the implementation logic for a method in a gRPC service. When Designer creates a gRPC method flow service as part of creating a gRPC descriptor, Designer defines the gRPC method flow service signature and inserts some basic logic. This basic logic consists of a MAP step that acts as a placeholder for any implementation logic that you want to add and two invocations for pub.grpc.observer* built-in services. It is up to developers to add implementation logic to the service.
In general, you edit a gRPC method flow service the same way you would a regular flow service. However, keep the following guidelines in mind when editing a gRPC method flow service:
*Do not change the gRPC method flow service signature. This includes not adding additional fields, renaming or removing any of the existing fields, or changing any of the data types for the existing fields.
*Do not remove the pub.grpc.obsever:onNext or pub.grpc.obvserver:onCompleted services. These services serialize the response, send it to the client, and close the connection between the embedded gRPC server and the remote gRPC client.
*Do not edit the pipeline for the pub.grpc.obsever:onNext or pub.grpc.obvserver:onCompleted services, including adding fields, dropping fields, assigning values, or mapping fields. One exception to this is that a fully populated IData representing the response message must be mapped into the document field of the INVOKE step for pub.grpc.obsever:onNext.
*The pub.grpc.obsever:onNext and pub.grpc.obvserver:onCompleted services must be the last two invoked services in the logic for successful execution and returning of a response to the requesting client. The output parameters for the gRPC method flow service must be populated prior to invocation of these services.
*If you add error handling logic and want to return an error to the gRPC client, invoke the pub.grpc.obvserver:onError service to specify the status code and message to send to the gRPC client. If you insert a call to the pub.grpc.obvserver:onError service, it should be the final step executed in that flow. After making a call to pub.grpc.obvserver:onError, do not make any calls to pub.grpc.obsever:onNext or pub.grpc.obvserver:onCompleted. Execution of the pub.grpc.obvserver:onError also closes the connection to the remote gRPC client.
*The MAP step that is the first step in the gRPC method flow service can be removed. Alternatively, you can add some or all of your implementation logic in the MAP step.
*All implementation logic must be placed in flow steps prior to the invocations of the pub.grpc.observer* services.
*The gRPC method flow services do not contain any TRY, CATCH, or FINALLY flow steps, but you can add them for error handling purposes.
*The final step executed in a gRPC method flow service must be either a pub.grpc.obvserver:onError or pub.grpc.obvserver:onCompleted service invocation.
Below is the grpcCalc.calc.calculator:Add gRPC method flow service added when the proto file containing calculator gRPC service was used to create a gRPC descriptor. The gRPC method flow service now contains implementation logic to perform the basic math operation.