Class OpennmsGrpcServer

  • All Implemented Interfaces:
    MessageConsumerManager, RpcClientFactory

    public class OpennmsGrpcServer
    extends AbstractMessageConsumerManager
    implements RpcClientFactory
    OpenNMS GRPC Server runs as OSGI bundle and it runs both RPC/Sink together. gRPC runs in a typical web server/client mode, so gRPC client runs on each minion and gRPC server runs on OpenNMS. Server initializes and creates two observers (RPC/Sink) that receive messages from the client (Minion).

    RPC : RPC runs in bi-directional streaming mode. OpenNMS needs a client(minion) handle for sending RPC request so minion always sends it's headers (SystemId/location) when it initializes. This Server maintains a list of client(minion) handles and sends RPC request to each minion in round-robin fashion. When it is directed RPC, server invokes specific minion handle directly. For each RPC request received, server creates a rpcId and maintains the state of this request in the concurrent map. The request is also added to a delay queue which can timeout the request if response is not received within expiration time. RPC responses are received in the observers that are created at start. Each response handling is done in a separate thread which may be used by rpc module to process the response.

    Sink: Sink runs in uni-directional streaming mode. OpenNMS receives sink messages from client and they are dispatched in the consumer threads that are initialized at start.

    • Constructor Detail

      • OpennmsGrpcServer

        public OpennmsGrpcServer()
    • Method Detail

      • start

        public void start()
                   throws java.io.IOException
        Throws:
        java.io.IOException
      • getRpcHandler

        public io.grpc.stub.StreamObserver<RpcRequestProto> getRpcHandler​(java.lang.String location,
                                                                          java.lang.String systemId)
      • getLocation

        public java.lang.String getLocation()
      • setLocation

        public void setLocation​(java.lang.String location)
      • getIdentity

        public Identity getIdentity()
      • setIdentity

        public void setIdentity​(Identity identity)
      • setConfigAdmin

        public void setConfigAdmin​(org.osgi.service.cm.ConfigurationAdmin configAdmin)
      • setRpcMetrics

        public void setRpcMetrics​(com.codahale.metrics.MetricRegistry metricRegistry)
      • getSinkMetrics

        public com.codahale.metrics.MetricRegistry getSinkMetrics()
      • setSinkMetrics

        public void setSinkMetrics​(com.codahale.metrics.MetricRegistry sinkMetrics)
      • setTracerRegistry

        public void setTracerRegistry​(TracerRegistry tracerRegistry)
      • getTracer

        public io.opentracing.Tracer getTracer()
      • shutdown

        public void shutdown()
      • getRpcHandlerByLocation

        public com.google.common.collect.Multimap<java.lang.String,​io.grpc.stub.StreamObserver<RpcRequestProto>> getRpcHandlerByLocation()