Class AsyncAuditEventRepository

java.lang.Object
io.leandev.appfuse.audit.AsyncAuditEventRepository
All Implemented Interfaces:
AuditControl, AutoCloseable, org.springframework.boot.actuate.audit.AuditEventRepository, org.springframework.context.Lifecycle, org.springframework.context.Phased, org.springframework.context.SmartLifecycle

public final class AsyncAuditEventRepository extends Object implements org.springframework.boot.actuate.audit.AuditEventRepository, AuditControl, org.springframework.context.SmartLifecycle, AutoCloseable
有界、可遺失的事件入口。呼叫者只做快照與 tryLock admission,不執行 I/O 或 logger。 關閉與 batch-start 共用短 gate;已標記 in-flight 的 batch 可以完成。
  • Constructor Details

  • Method Details

    • add

      public void add(org.springframework.boot.actuate.audit.AuditEvent event)
      Specified by:
      add in interface org.springframework.boot.actuate.audit.AuditEventRepository
    • find

      public List<org.springframework.boot.actuate.audit.AuditEvent> find(String principal, Instant after, String type)
      Specified by:
      find in interface org.springframework.boot.actuate.audit.AuditEventRepository
    • start

      public void start()
      Specified by:
      start in interface org.springframework.context.Lifecycle
    • status

      public AuditStatus status()
      Specified by:
      status in interface AuditControl
    • setEnabled

      public AuditStatus setEnabled(boolean value)
      Specified by:
      setEnabled in interface AuditControl
    • setEnabled

      public AuditStatus setEnabled(boolean value, String principal)
      Description copied from interface: AuditControl
      提供操作者給可遺失的背景操作紀錄;不等待日誌完成,不保證保存。 未實作此 overload 的既有控制器仍沿用原有切換行為。
      Specified by:
      setEnabled in interface AuditControl
    • setEnabled

      public AuditStatus setEnabled(boolean value, String principal, String subject)
      Description copied from interface: AuditControl
      principal 為真實操作者;模擬時可另提供有效身份 subject,非模擬時傳 null。 既有控制器沿用雙參數行為,背景紀錄仍可遺失。
      Specified by:
      setEnabled in interface AuditControl
    • isRunning

      public boolean isRunning()
      Specified by:
      isRunning in interface org.springframework.context.Lifecycle
    • getPhase

      public int getPhase()
      Specified by:
      getPhase in interface org.springframework.context.Phased
      Specified by:
      getPhase in interface org.springframework.context.SmartLifecycle
    • isPauseable

      public boolean isPauseable()
      Specified by:
      isPauseable in interface org.springframework.context.SmartLifecycle
    • stop

      public void stop()
      Specified by:
      stop in interface org.springframework.context.Lifecycle
    • stop

      public void stop(Runnable callback)
      Specified by:
      stop in interface org.springframework.context.SmartLifecycle
    • close

      public void close()
      Specified by:
      close in interface AutoCloseable