Class BufferedBatchPublisher
java.lang.Object
org.forgerock.audit.events.handlers.buffering.BufferedBatchPublisher
- All Implemented Interfaces:
BatchPublisher
Buffers audit events to a bounded queue, periodically flushing the queue to a provided
BatchConsumer
.
If the bounded queue becomes full, further events are dropped until the queue is next flushed.-
Nested Class Summary
Modifier and TypeClassDescriptionstatic interface
Builder used to construct a newBufferedBatchPublisher
. -
Method Summary
Modifier and TypeMethodDescriptionnewBuilder
(BatchConsumer batchConsumer) Provides a new builder.boolean
Inserts the specified element at the tail of this queue if it is possible to do so immediately without exceeding the queue's capacity, returningtrue
upon success andfalse
if this queue is full.void
shutdown()
Stops sending batch data, and awaits termination of pending queue tasks whenautoFlush
is enabled.void
startup()
Starts periodically sending batch data.
-
Method Details
-
startup
public void startup()Starts periodically sending batch data.- Specified by:
startup
in interfaceBatchPublisher
-
shutdown
public void shutdown()Stops sending batch data, and awaits termination of pending queue tasks whenautoFlush
is enabled.- Specified by:
shutdown
in interfaceBatchPublisher
-
offer
Inserts the specified element at the tail of this queue if it is possible to do so immediately without exceeding the queue's capacity, returningtrue
upon success andfalse
if this queue is full.- Specified by:
offer
in interfaceBatchPublisher
- Parameters:
topic
- Event topicevent
- Event payload to index, where_id
field is the identifier- Returns:
true
if the element was added to this queue, elsefalse
-
newBuilder
Provides a new builder.- Parameters:
batchConsumer
- a non-null batch consumer- Returns:
- a new builder
-