Class AsynchronousAuditMessageQueue

  • All Implemented Interfaces:
    AuditMessageQueue

    public class AsynchronousAuditMessageQueue
    extends Object
    Audit queue that uses an injectable ExecutorService to asynchronously send away audit events. When this queue is shut down, the executor service is also, waiting for at most shutdownTimeoutSeconds until all pending events are sent.

    Note that the ExecutorService must be explicitly set, otherwise the implementation sends away the event synchronously. The parameters of the ExecutorService determine the behavior of the queue implementation, e.g. in case the audit destination is not reachable.

    Since:
    3.5
    Author:
    Christian Ohr
    • Constructor Detail

      • AsynchronousAuditMessageQueue

        public AsynchronousAuditMessageQueue()
    • Method Detail

      • setExecutorService

        public void setExecutorService​(ExecutorService executorService)
        Sets the executor service. If this is null (or not used), audit events are sent synchronously
        Parameters:
        executorService - executor service
      • setShutdownTimeoutSeconds

        public void setShutdownTimeoutSeconds​(int shutdownTimeoutSeconds)
        Sets the timeout before the executor service closes. Defaults to 10
        Parameters:
        shutdownTimeoutSeconds - timeout before the executor service closes
      • shutdown

        public void shutdown()
        Description copied from interface: AuditMessageQueue
        Flushes the queue and shutdown any associated runtime daemons that may be handling queue inflow/outflow
      • audit

        public void audit​(AuditContext auditContext,
                          AuditMessage... auditMessages)
        Specified by:
        audit in interface AuditMessageQueue
        Parameters:
        auditContext - IPF audit context
        auditMessages - one or more audit message instances
      • setPretty

        public void setPretty​(boolean pretty)