Class CompositeAuditService

java.lang.Object
com.svenruppert.jsentinel.audit.CompositeAuditService
All Implemented Interfaces:
JSentinelAuditService

public final class CompositeAuditService extends Object implements JSentinelAuditService
JSentinelAuditService that fans every published event out to: Every sink runs independently — a failing extra sink does not stop the fan-out and never causes publish(...) to throw.

Queries always read from the ring buffer. Applications that need a different query backend can wrap this class.

  • Constructor Details

    • CompositeAuditService

      public CompositeAuditService(RingBufferAuditSink ringBuffer, AuditSink... extraSinks)
      Parameters:
      ringBuffer - query-backing in-memory buffer, never null
      extraSinks - additional write-only sinks; may be empty
  • Method Details

    • publish

      public void publish(AuditEvent event)
      Description copied from interface: JSentinelAuditService
      Records the given event. Never throws.
      Specified by:
      publish in interface JSentinelAuditService
      Parameters:
      event - non-null typed audit event
    • query

      public List<AuditEvent> query(AuditQuery query)
      Description copied from interface: JSentinelAuditService
      Returns retained events matching query, oldest first. Implementations that do not retain events return an empty list.
      Specified by:
      query in interface JSentinelAuditService
      Parameters:
      query - filter, never null
      Returns:
      retained matching events, never null
    • ringBuffer

      public RingBufferAuditSink ringBuffer()
      Visible for application setup code that wants to consult the buffer directly.
    • extraSinks

      public List<AuditSink> extraSinks()
      Returns an unmodifiable snapshot of the configured extra sinks.