Package org.opennms.core.ipc.rpc.kafka
Class KafkaRpcClientFactory
- java.lang.Object
-
- org.opennms.core.ipc.rpc.kafka.KafkaRpcClientFactory
-
- All Implemented Interfaces:
RpcClientFactory
public class KafkaRpcClientFactory extends java.lang.Object implements RpcClientFactory
This Client Factory runs on OpenNMS. Whenever a Client receives an RPC request, it generates a unique rpcId and initiates a response handler unique to the rpcId. It also starts a consumer thread for the specific RPC module if it doesn't exist yet.The client also expands the buffer into chunks if it is larger than the configured buffer size. The client then sends the request to Kafka. If it is directed RPC (to a specific minion) it sends the request to all partitions there by to all consumers (minions).
Consumer thread (one for each module) will receive the response and send it to a response handler which will return the response.
Timeout tracker thread will fetch the response handler from it's delay queue and send a timeout response if it is not finished already.
-
-
Field Summary
-
Fields inherited from interface org.opennms.core.rpc.api.RpcClientFactory
JMX_DOMAIN_RPC, LOG_PREFIX, RPC_DURATION, RPC_FAILED, RPC_REQUEST_SENT, RPC_REQUEST_SIZE, RPC_REQUESTS_RECEIVED, RPC_RESPONSE_SIZE
-
-
Constructor Summary
Constructors Constructor Description KafkaRpcClientFactory()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description <S extends RpcRequest,T extends RpcResponse>
RpcClient<S,T>getClient(RpcModule<S,T> module)
com.codahale.metrics.MetricRegistry
getMetrics()
TracerRegistry
getTracerRegistry()
void
setLocation(java.lang.String location)
void
setMetrics(com.codahale.metrics.MetricRegistry metrics)
void
setTracerRegistry(TracerRegistry tracerRegistry)
void
start()
void
stop()
-
-
-
Method Detail
-
getClient
public <S extends RpcRequest,T extends RpcResponse> RpcClient<S,T> getClient(RpcModule<S,T> module)
- Specified by:
getClient
in interfaceRpcClientFactory
-
setLocation
public void setLocation(java.lang.String location)
-
setTracerRegistry
public void setTracerRegistry(TracerRegistry tracerRegistry)
-
getTracerRegistry
public TracerRegistry getTracerRegistry()
-
getMetrics
public com.codahale.metrics.MetricRegistry getMetrics()
-
setMetrics
public void setMetrics(com.codahale.metrics.MetricRegistry metrics)
-
start
public void start()
-
stop
public void stop()
-
-