Class AsynchronousAuditMessageQueue
- java.lang.Object
-
- org.openehealth.ipf.commons.audit.queue.AsynchronousAuditMessageQueue
-
- All Implemented Interfaces:
AuditMessageQueue
public class AsynchronousAuditMessageQueue extends Object
Audit queue that uses an injectableExecutorService
to asynchronously send away audit events. When this queue isshut down
, the executor service is also, waiting for at mostshutdownTimeoutSeconds
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 theExecutorService
determine the behavior of the queue implementation, e.g. in case the audit destination is not reachable.- Since:
- 3.5
- Author:
- Christian Ohr
-
-
Field Summary
-
Fields inherited from interface org.openehealth.ipf.commons.audit.queue.AuditMessageQueue
X_IPF_ATNA_APPLICATION, X_IPF_ATNA_HOSTNAME, X_IPF_ATNA_PROCESSID, X_IPF_ATNA_TIMESTAMP
-
-
Constructor Summary
Constructors Constructor Description AsynchronousAuditMessageQueue()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
audit(AuditContext auditContext, AuditMessage... auditMessages)
protected void
handle(AuditContext auditContext, String auditRecord)
void
setExecutorService(ExecutorService executorService)
Sets the executor service.void
setPretty(boolean pretty)
void
setShutdownTimeoutSeconds(int shutdownTimeoutSeconds)
Sets the timeout before the executor service closes.void
shutdown()
Flushes the queue and shutdown any associated runtime daemons that may be handling queue inflow/outflow-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.openehealth.ipf.commons.audit.queue.AuditMessageQueue
flush
-
-
-
-
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
-
handle
protected void handle(AuditContext auditContext, String auditRecord)
-
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 interfaceAuditMessageQueue
- Parameters:
auditContext
- IPF audit contextauditMessages
- one or more audit message instances
-
setPretty
public void setPretty(boolean pretty)
-
-