Package org.opennms.core.ipc.grpc.client
Class MinionGrpcClient
- java.lang.Object
-
- org.opennms.core.ipc.sink.common.AbstractMessageDispatcherFactory<java.lang.String>
-
- org.opennms.core.ipc.grpc.client.MinionGrpcClient
-
- All Implemented Interfaces:
MessageDispatcherFactory
public class MinionGrpcClient extends AbstractMessageDispatcherFactory<java.lang.String>
Minion GRPC client 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. Minion GRPC Client tries to get two stubs/streams (RPC/Sink) from OpenNMS server when it is in active state. It also initializes RPC observer/handler to receive requests from OpenNMS.RPC : RPC runs in bi-directional streaming mode. Minion gets each request and it handles each request in a separate thread. Once the request is executed, the response sender call is synchronized as writing to observer is not thread-safe. Minion also sends it's headers (SystemId/location) to OpenNMS whenever the stub is initialized.
Sink: Sink runs in uni-directional streaming mode. If the sink module is async and OpenNMS Server is not active, the messages are buffered and blocked till minion is able to connect to OpenNMS.
-
-
Constructor Summary
Constructors Constructor Description MinionGrpcClient(MinionIdentity identity, org.osgi.service.cm.ConfigurationAdmin configAdmin)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
bind(RpcModule module)
<S extends Message,T extends Message>
voiddispatch(SinkModule<S,T> module, java.lang.String metadata, T message)
org.osgi.framework.BundleContext
getBundleContext()
java.lang.String
getMetricDomain()
com.codahale.metrics.MetricRegistry
getMetrics()
io.opentracing.Tracer
getTracer()
TracerRegistry
getTracerRegistry()
void
setBundleContext(org.osgi.framework.BundleContext bundleContext)
void
setMetrics(com.codahale.metrics.MetricRegistry metrics)
void
setTracerRegistry(TracerRegistry tracerRegistry)
void
shutdown()
void
start()
void
unbind(RpcModule module)
-
Methods inherited from class org.opennms.core.ipc.sink.common.AbstractMessageDispatcherFactory
createAsyncDispatcher, createSyncDispatcher, createSyncDispatcher, getModuleMetadata, onDestroy, onInit
-
-
-
-
Constructor Detail
-
MinionGrpcClient
public MinionGrpcClient(MinionIdentity identity, org.osgi.service.cm.ConfigurationAdmin configAdmin)
-
-
Method Detail
-
start
public void start() throws java.io.IOException
- Throws:
java.io.IOException
-
bind
public void bind(RpcModule module) throws java.lang.Exception
- Throws:
java.lang.Exception
-
unbind
public void unbind(RpcModule module) throws java.lang.Exception
- Throws:
java.lang.Exception
-
shutdown
public void shutdown()
-
setBundleContext
public void setBundleContext(org.osgi.framework.BundleContext bundleContext)
-
getMetricDomain
public java.lang.String getMetricDomain()
- Specified by:
getMetricDomain
in classAbstractMessageDispatcherFactory<java.lang.String>
-
getBundleContext
public org.osgi.framework.BundleContext getBundleContext()
- Specified by:
getBundleContext
in classAbstractMessageDispatcherFactory<java.lang.String>
-
getTracer
public io.opentracing.Tracer getTracer()
- Specified by:
getTracer
in classAbstractMessageDispatcherFactory<java.lang.String>
-
getMetrics
public com.codahale.metrics.MetricRegistry getMetrics()
- Specified by:
getMetrics
in classAbstractMessageDispatcherFactory<java.lang.String>
-
setMetrics
public void setMetrics(com.codahale.metrics.MetricRegistry metrics)
-
getTracerRegistry
public TracerRegistry getTracerRegistry()
-
setTracerRegistry
public void setTracerRegistry(TracerRegistry tracerRegistry)
-
dispatch
public <S extends Message,T extends Message> void dispatch(SinkModule<S,T> module, java.lang.String metadata, T message)
- Specified by:
dispatch
in classAbstractMessageDispatcherFactory<java.lang.String>
-
-