Class CommandableGrpcController
java.lang.Object
org.pipservices4.grpc.controllers.GrpcController
org.pipservices4.grpc.controllers.CommandableGrpcController
- All Implemented Interfaces:
org.pipservices4.components.config.IConfigurable,org.pipservices4.components.refer.IReferenceable,org.pipservices4.components.refer.IUnreferenceable,org.pipservices4.components.run.IClosable,org.pipservices4.components.run.IOpenable,IRegisterable
Abstract service that receives commands via GRPC protocol
to operations automatically generated for commands defined in
ICommandable.
Each command is exposed as invoke method that receives command name and parameters.
Commandable services require only 3 lines of code to implement a robust external GRPC-based remote interface.
### Configuration parameters ###
- dependencies:
- endpoint: override for HTTP Endpoint dependency
- controller: override for Controller dependency
- connection(s):
- discovery_key: (optional) a key to retrieve the connection from IDiscovery
- protocol: connection protocol: http or https
- host: host name or IP address
- port: port number
- uri: resource URI or connection string with all parameters in it
### References ###
- *:logger:*:*:1.0 (optional) ILogger components to pass log messages
- *:counters:*:*:1.0 (optional) ICounters components to pass collected measurements
- *:discovery:*:*:1.0 (optional) IDiscovery services to resolve connection
- *:endpoint:grpc:*:1.0invalid input: '<' (optional) GrpcEndpoint reference
- See Also:
-
Field Summary
Fields inherited from class org.pipservices4.grpc.controllers.GrpcController
_counters, _dependencyResolver, _endpoint, _logger, _tracer -
Constructor Summary
ConstructorsConstructorDescriptionCreates a new instance of the service. -
Method Summary
Modifier and TypeMethodDescriptionvoidregister()Registers all service routes in HTTP endpoint.protected voidregisterCommadableMethod(String method, org.pipservices4.grpc.controllers.CommandFunction action) Registers a commandable method in this objects GRPC server (service) by the given name.,Methods inherited from class org.pipservices4.grpc.controllers.GrpcController
close, configure, instrument, isOpen, open, registerInterceptor, registerMethod, setReferences, unsetReferences
-
Constructor Details
-
CommandableGrpcController
Creates a new instance of the service.- Parameters:
name- a service name.
-
-
Method Details
-
registerCommadableMethod
protected void registerCommadableMethod(String method, org.pipservices4.grpc.controllers.CommandFunction action) Registers a commandable method in this objects GRPC server (service) by the given name.,- Parameters:
method- the GRPC method name.action- the action to perform at the given route.
-
register
public void register()Registers all service routes in HTTP endpoint.- Specified by:
registerin interfaceIRegisterable- Specified by:
registerin classGrpcController
-