Class AsynchronousAuditMessageQueue

java.lang.Object
org.openehealth.ipf.commons.audit.queue.AbstractAuditMessageQueue
org.openehealth.ipf.commons.audit.queue.AsynchronousAuditMessageQueue
All Implemented Interfaces:
AuditMessageQueue

public class AsynchronousAuditMessageQueue extends AbstractAuditMessageQueue
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 Details

    • AsynchronousAuditMessageQueue

      public AsynchronousAuditMessageQueue()
  • Method Details

    • 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
    • handle

      protected void handle(AuditContext auditContext, String auditRecord)
      Specified by:
      handle in class AbstractAuditMessageQueue
    • 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