public class AsynchronousAuditMessageQueue extends Object
ExecutorService
to asynchonously 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.
Constructor and Description |
---|
AsynchronousAuditMessageQueue() |
Modifier and Type | Method and Description |
---|---|
void |
audit(AuditContext auditContext,
AuditMessage... auditMessages) |
protected void |
handle(AuditContext auditContext,
String... auditRecords) |
void |
setExecutorService(ExecutorService executorService)
Sets the executor service.
|
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
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
flush
public void setExecutorService(ExecutorService executorService)
executorService
- executor servicepublic void setShutdownTimeoutSeconds(int shutdownTimeoutSeconds)
shutdownTimeoutSeconds
- timeout before the executor service closesprotected void handle(AuditContext auditContext, String... auditRecords)
public void shutdown()
AuditMessageQueue
public void audit(AuditContext auditContext, AuditMessage... auditMessages)
audit
in interface AuditMessageQueue
Copyright © 2018 Open eHealth Foundation. All rights reserved.