GRPCService
public protocol GRPCService
GRPCService
is a protocol that is implemented to declare gRPC services that can contain remote procedure calls.
This protocol requires services to contain a serviceName
and provide a handleMethod
method that maps requests to call handlers which can call the procedures.
-
serviceName
Default implementationA string containing the services name.
Default Implementation
The default implementation of the
serviceName
returns the last part of the services class or struct name using reflection.Declaration
Swift
var serviceName: String { get }
-
handleMethod(methodName:
Default implementationvaporRequest: ) Returns associated call handler of the service for a procedure call name and the associated Vapor
Request
.This method is usually generated by the code generator for every
GRPCService
.Default Implementation
The default implementation of the
handleMethod
method always returnsnil
. T This implementation should be overriden by the code generated for every service. The default implementation however is provided in order to prevent syntax errors before running the code generator and developers from implementing this method themselves.Declaration
Swift
func handleMethod(methodName: String, vaporRequest: Request) -> AnyCallHandler?
Parameters
methodName
String
with the name of the called remote procedure.Return Value
An
AnyCallHandler
call handler that calls the requested procedure.