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 provided BatchConsumer. If the bounded queue becomes full, further events are dropped until the queue is next flushed.
  • Method Details

    • startup

      public void startup()
      Starts periodically sending batch data.
      Specified by:
      startup in interface BatchPublisher
    • shutdown

      public void shutdown()
      Stops sending batch data, and awaits termination of pending queue tasks when autoFlush is enabled.
      Specified by:
      shutdown in interface BatchPublisher
    • 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, returning true upon success and false if this queue is full.
      Specified by:
      offer in interface BatchPublisher
      Parameters:
      topic - Event topic
      event - Event payload to index, where _id field is the identifier
      Returns:
      true if the element was added to this queue, else false
    • newBuilder

      public static BufferedBatchPublisher.Builder newBuilder(BatchConsumer batchConsumer)
      Provides a new builder.
      Parameters:
      batchConsumer - a non-null batch consumer
      Returns:
      a new builder