Class: Gruf::Server
Overview
Represents a gRPC server. Automatically loads and augments gRPC handlers and services based on configuration values.
Instance Attribute Summary collapse
-
#server ⇒ GRPC::RpcServer
readonly
The GRPC server running.
-
#services ⇒ Array<Class>
The services this server is handling.
Instance Method Summary collapse
-
#initialize(services: []) ⇒ Server
constructor
Initialize the server and load and setup the services.
-
#start! ⇒ Object
Start the gRPC server.
Methods included from Loggable
Constructor Details
#initialize(services: []) ⇒ Server
Initialize the server and load and setup the services
35 36 37 38 |
# File 'lib/gruf/server.rb', line 35 def initialize(services: []) setup! load_services(services) end |
Instance Attribute Details
#server ⇒ GRPC::RpcServer (readonly)
Returns The GRPC server running.
43 44 45 |
# File 'lib/gruf/server.rb', line 43 def server @server end |
#services ⇒ Array<Class>
Returns The services this server is handling.
26 27 28 |
# File 'lib/gruf/server.rb', line 26 def services @services end |
Instance Method Details
#start! ⇒ Object
Start the gRPC server
:nocov:
58 59 60 61 62 |
# File 'lib/gruf/server.rb', line 58 def start! logger.info { 'Booting gRPC Server...' } server.run_till_terminated logger.info { 'Shutting down gRPC server...' } end |