Class BufferedBatchPublisher
- java.lang.Object
-
- org.forgerock.audit.events.handlers.buffering.BufferedBatchPublisher
-
- All Implemented Interfaces:
BatchPublisher
public final class BufferedBatchPublisher extends Object implements BatchPublisher
Buffers audit events to a bounded queue, periodically flushing the queue to a providedBatchConsumer
. If the bounded queue becomes full, further events are dropped until the queue is next flushed.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interface
BufferedBatchPublisher.Builder
Builder used to construct a newBufferedBatchPublisher
.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static BufferedBatchPublisher.Builder
newBuilder(BatchConsumer batchConsumer)
Provides a new builder.boolean
offer(String topic, JsonValue event)
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 Detail
-
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
public boolean offer(String topic, JsonValue event)
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
public static BufferedBatchPublisher.Builder newBuilder(BatchConsumer batchConsumer)
Provides a new builder.- Parameters:
batchConsumer
- a non-null batch consumer- Returns:
- a new builder
-
-