Package org.opennms.core.ipc.sink.common
Class AbstractMessageConsumerManager
- java.lang.Object
-
- org.opennms.core.ipc.sink.common.AbstractMessageConsumerManager
-
- All Implemented Interfaces:
MessageConsumerManager
- Direct Known Subclasses:
AmazonSQSMessageConsumerManager
,CamelMessageConsumerManager
,KafkaMessageConsumerManager
,OpennmsGrpcServer
,OsgiIpcManager
public abstract class AbstractMessageConsumerManager extends java.lang.Object implements MessageConsumerManager
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
SINK_INITIAL_SLEEP_TIME
protected java.util.concurrent.ExecutorService
startupExecutor
java.util.concurrent.CompletableFuture<java.lang.Void>
waitForStartup
-
Fields inherited from interface org.opennms.core.ipc.sink.api.MessageConsumerManager
LOG_PREFIX, METRIC_DISPATCH_TIME, METRIC_MESSAGE_SIZE, METRIC_MESSAGES_RECEIVED
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
AbstractMessageConsumerManager()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description <S extends Message,T extends Message>
voiddispatch(SinkModule<S,T> module, T message)
static int
getNumConsumerThreads(SinkModule<?,?> module)
java.util.concurrent.ExecutorService
getStartupExecutor()
<S extends Message,T extends Message>
voidregisterConsumer(MessageConsumer<S,T> consumer)
protected abstract void
startConsumingForModule(SinkModule<?,Message> module)
protected abstract void
stopConsumingForModule(SinkModule<?,Message> module)
void
unregisterAllConsumers()
<S extends Message,T extends Message>
voidunregisterConsumer(MessageConsumer<S,T> consumer)
-
-
-
Field Detail
-
SINK_INITIAL_SLEEP_TIME
public static final java.lang.String SINK_INITIAL_SLEEP_TIME
- See Also:
- Constant Field Values
-
startupExecutor
protected final java.util.concurrent.ExecutorService startupExecutor
-
waitForStartup
public final java.util.concurrent.CompletableFuture<java.lang.Void> waitForStartup
-
-
Method Detail
-
startConsumingForModule
protected abstract void startConsumingForModule(SinkModule<?,Message> module) throws java.lang.Exception
- Throws:
java.lang.Exception
-
stopConsumingForModule
protected abstract void stopConsumingForModule(SinkModule<?,Message> module) throws java.lang.Exception
- Throws:
java.lang.Exception
-
dispatch
public <S extends Message,T extends Message> void dispatch(SinkModule<S,T> module, T message)
- Specified by:
dispatch
in interfaceMessageConsumerManager
-
registerConsumer
public <S extends Message,T extends Message> void registerConsumer(MessageConsumer<S,T> consumer) throws java.lang.Exception
- Specified by:
registerConsumer
in interfaceMessageConsumerManager
- Throws:
java.lang.Exception
-
unregisterConsumer
public <S extends Message,T extends Message> void unregisterConsumer(MessageConsumer<S,T> consumer) throws java.lang.Exception
- Specified by:
unregisterConsumer
in interfaceMessageConsumerManager
- Throws:
java.lang.Exception
-
unregisterAllConsumers
public void unregisterAllConsumers() throws java.lang.Exception
- Throws:
java.lang.Exception
-
getNumConsumerThreads
public static int getNumConsumerThreads(SinkModule<?,?> module)
-
getStartupExecutor
public java.util.concurrent.ExecutorService getStartupExecutor()
-
-