java.lang.Object
com.github.eventmanager.internal.ManagerBase
- Direct Known Subclasses:
EventManager
,InternalEventManager
Abstract base class providing foundational functionality for event management,
including event queuing, processing, and logging.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final BlockingQueue<String>
Queue that holds events ready to be written to the log file.protected LogHandler
Handles log file writing and log configuration.protected OutputHelper
Helper class for output operations.protected final BlockingQueue<String>
Queue that holds events pending processing by processors.protected ProcessorHelper
Processes and enriches log events. -
Constructor Summary
ConstructorsConstructorDescriptionManagerBase
(LogHandler logHandler) Initializes ManagerBase with a provided LogHandler instance.ManagerBase
(String configPath) Initializes ManagerBase using a configuration file path. -
Method Summary
Modifier and TypeMethodDescriptionboolean
addOutput
(OutputEntry output) Adds a new output destination.boolean
addProcessor
(ProcessorEntry processorName) Adds a new processor to the list of processors.protected static String
protected void
Starts event processing and logging threads.protected void
initiateThreads
(InternalEventManager internalEventManager) Starts event processing and logging threads.protected void
logMessage
(String level, KeyValueWrapper... messages) Logs a message to the destination file.protected void
logMessage
(String level, Object message) Formats and queues a log message for processing and eventual writing to log file.protected void
outputEvent
(InternalEventManager internalEventManager, String event) Passes the event to the output or outputs specified in the runtime or config specification.protected void
outputEvent
(String event) Passes the event to the output or outputs specified in the runtime or config specification.boolean
removeOutput
(OutputEntry outputEntry) Removes an output destination.boolean
removeOutput
(String outputName) Removes an output destination by class name.protected boolean
removeProcessor
(ProcessorEntry processorEntry) Removes a processor from the list of processors.boolean
removeProcessor
(String processorName) Removes a processor from the list of processors.protected void
Stops all threads gracefully without structured logging.protected void
stopAllThreads
(InternalEventManager internalEventManager) Stops all threads gracefully and processes remaining events, using InternalEventManager for structured logging of shutdown status.protected void
Adds raw event to the processing queue.protected void
writeEventToQueue
(String event) Adds processed event to the event queue.
-
Field Details
-
logHandler
Handles log file writing and log configuration. -
processorHelper
Processes and enriches log events. -
outputHelper
Helper class for output operations. -
eventQueue
Queue that holds events ready to be written to the log file. -
processingQueue
Queue that holds events pending processing by processors.
-
-
Constructor Details
-
ManagerBase
Initializes ManagerBase with a provided LogHandler instance.- Parameters:
logHandler
- The LogHandler responsible for managing logging operations.
-
ManagerBase
Initializes ManagerBase using a configuration file path.- Parameters:
configPath
- Path to the logging configuration file.
-
-
Method Details
-
initiateThreads
protected void initiateThreads()Starts event processing and logging threads. -
initiateThreads
Starts event processing and logging threads. -
stopAllThreads
Stops all threads gracefully and processes remaining events, using InternalEventManager for structured logging of shutdown status.- Parameters:
internalEventManager
- The event manager used for logging shutdown information.
-
stopAllThreads
protected void stopAllThreads()Stops all threads gracefully without structured logging. Logs status information directly to the standard output. -
logMessage
Formats and queues a log message for processing and eventual writing to log file.- Parameters:
level
- Log level (e.g., INFO, ERROR).message
- Message content to log, which can be an Exception or String.
-
logMessage
Logs a message to the destination file.- Parameters:
level
- the log level of the message.messages
- an object array to be appended to the message.
-
writeEventToQueue
Adds processed event to the event queue.- Parameters:
event
- The event string after processing.
-
writeEventToProcessingQueue
Adds raw event to the processing queue.- Parameters:
event
- The event string before processing.
-
outputEvent
Passes the event to the output or outputs specified in the runtime or config specification. -
outputEvent
Passes the event to the output or outputs specified in the runtime or config specification. -
addOutput
Adds a new output destination.- Parameters:
output
- The output entry to add.- Returns:
- true if the output was added successfully, false otherwise.
-
removeOutput
Removes an output destination.- Parameters:
outputEntry
- The output entry to remove.- Returns:
- true if the output was removed successfully, false otherwise.
-
removeOutput
Removes an output destination by class name.- Parameters:
outputName
- The class name of the output to remove.- Returns:
- true if the output was removed successfully, false otherwise.
-
addProcessor
Adds a new processor to the list of processors.- Parameters:
processorName
- The processor entry to add.- Returns:
- true if the processor was added successfully, false otherwise.
-
removeProcessor
Removes a processor from the list of processors.- Parameters:
processorName
- The class name of the processor to remove.- Returns:
- true if the processor was removed successfully, false otherwise.
-
removeProcessor
Removes a processor from the list of processors.- Parameters:
processorEntry
- The processor entry to remove.- Returns:
- true if the processor was removed successfully, false otherwise.
-
castExceptionStackTraceToString
-