Class AlarmSender

java.lang.Object
java.lang.Thread
org.bgerp.app.exception.alarm.AlarmSender
All Implemented Interfaces:
Runnable

public class AlarmSender extends Thread
Sender alarms to a configured email
  • Method Details

    • init

      public static void init(Setup setup)
      Initializes the sender and subscribes to SetupChangedEvent for 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 suppression
      defaultInterval - default minimal interval between alarms in ms, used if not configured for the key
      subject - email subject
      text - alarm text supplier
      ex - related exception, may be null
      attachments - attachments supplier, may be null
    • send

      public static void send(String key, long defaultInterval, String subject, Supplier<String> text)
      Queues an alarm without a related exception or attachments.
      Parameters:
      key - alarm key, used for interval suppression
      defaultInterval - default minimal interval between alarms in ms, used if not configured for the key
      subject - email subject
      text - alarm text supplier
    • run

      public void run()
      Specified by:
      run in interface Runnable
      Overrides:
      run in class Thread