Interface AlertSinkInterface

All Known Implementing Classes:
LoggingAlertSink

public interface AlertSinkInterface
Where QAlerts sends signals. The default is LoggingAlertSink; an alerts implementation (such as qbit-alerts) registers its own through AlertsInstanceMetaData.withSink. Methods are called after the caller's transaction commits (or at once, when there is none), on the caller's thread, so they must be fast: queue the work, don't do database writes or network calls inline. Anything they throw is caught, logged and counted by QAlerts; it never reaches the producer. notify (user notifications) is a default method that only debug-logs, so sinks written before it existed still compile and work; an implementation that delivers notifications overrides it. A new instance is not loaded per call: QAlerts loads the sink once per QInstance and reuses it, so implementations must be thread-safe.
  • Method Details

    • raise

      void raise(AlertSignal signal)
      Record (or refresh) an alert. The signal's occurredAt is always set.
    • resolve

      void resolve(AlertResolution resolution)
      Resolve an open alert, if there is one. resolvedAt is always set.
    • heartbeat

      void heartbeat(String heartbeatKey, Instant at)
      Note that a dead-man's switch beat.
    • notify

      default void notify(NotificationSignal signal)
      Deliver a user notification. occurredAt, severity, category and audience are always set. The default does nothing beyond a debug log; an implementation that has a notifications inbox overrides it.