Class AlarmSender
java.lang.Object
java.lang.Thread
org.bgerp.app.exception.alarm.AlarmSender
- All Implemented Interfaces:
Runnable
Sender alarms to a configured email
-
Nested Class Summary
Nested classes/interfaces inherited from class Thread
Thread.Builder, Thread.State, Thread.UncaughtExceptionHandler -
Field Summary
Fields inherited from class Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY -
Method Summary
Modifier and TypeMethodDescriptionstatic voidInitializes the sender and subscribes toSetupChangedEventfor reconfiguration.voidrun()static voidQueues an alarm without a related exception or attachments.static voidsend(String key, long defaultInterval, String subject, Supplier<String> text, Exception ex, Supplier<List<FileData>> attachments) Queues an alarm to be sent, unless suppressed by the per-key minimal interval.Methods inherited from class Thread
activeCount, checkAccess, clone, currentThread, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, isVirtual, join, join, join, join, ofPlatform, ofVirtual, onSpinWait, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, sleep, start, startVirtualThread, stop, threadId, toString, yield
-
Method Details
-
init
Initializes the sender and subscribes toSetupChangedEventfor reconfiguration.- Parameters:
setup- application configuration
-
send
public static void send(String key, long defaultInterval, String subject, Supplier<String> text, Exception ex, Supplier<List<FileData>> attachments) Queues an alarm to be sent, unless suppressed by the per-key minimal interval.- Parameters:
key- alarm key, used for interval suppressiondefaultInterval- default minimal interval between alarms in ms, used if not configured for the keysubject- email subjecttext- alarm text supplierex- related exception, may benullattachments- attachments supplier, may benull
-
send
Queues an alarm without a related exception or attachments.- Parameters:
key- alarm key, used for interval suppressiondefaultInterval- default minimal interval between alarms in ms, used if not configured for the keysubject- email subjecttext- alarm text supplier
-
run
-