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 可以完成。
-
Field Summary
Fields inherited from interface org.springframework.context.SmartLifecycle
DEFAULT_PHASE -
Constructor Summary
ConstructorsConstructorDescriptionAsyncAuditEventRepository(AuditStorage storage, AuditWriteSettings settings) -
Method Summary
Modifier and TypeMethodDescriptionvoidadd(org.springframework.boot.actuate.audit.AuditEvent event) voidclose()List<org.springframework.boot.actuate.audit.AuditEvent> intgetPhase()booleanbooleansetEnabled(boolean value) setEnabled(boolean value, String principal) 提供操作者給可遺失的背景操作紀錄;不等待日誌完成,不保證保存。 未實作此 overload 的既有控制器仍沿用原有切換行為。setEnabled(boolean value, String principal, String subject) principal 為真實操作者;模擬時可另提供有效身份 subject,非模擬時傳 null。 既有控制器沿用雙參數行為,背景紀錄仍可遺失。voidstart()status()voidstop()voidMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.springframework.context.SmartLifecycle
isAutoStartup
-
Constructor Details
-
AsyncAuditEventRepository
-
-
Method Details
-
add
public void add(org.springframework.boot.actuate.audit.AuditEvent event) - Specified by:
addin interfaceorg.springframework.boot.actuate.audit.AuditEventRepository
-
find
-
start
public void start()- Specified by:
startin interfaceorg.springframework.context.Lifecycle
-
status
- Specified by:
statusin interfaceAuditControl
-
setEnabled
- Specified by:
setEnabledin interfaceAuditControl
-
setEnabled
Description copied from interface:AuditControl提供操作者給可遺失的背景操作紀錄;不等待日誌完成,不保證保存。 未實作此 overload 的既有控制器仍沿用原有切換行為。- Specified by:
setEnabledin interfaceAuditControl
-
setEnabled
Description copied from interface:AuditControlprincipal 為真實操作者;模擬時可另提供有效身份 subject,非模擬時傳 null。 既有控制器沿用雙參數行為,背景紀錄仍可遺失。- Specified by:
setEnabledin interfaceAuditControl
-
isRunning
public boolean isRunning()- Specified by:
isRunningin interfaceorg.springframework.context.Lifecycle
-
getPhase
public int getPhase()- Specified by:
getPhasein interfaceorg.springframework.context.Phased- Specified by:
getPhasein interfaceorg.springframework.context.SmartLifecycle
-
isPauseable
public boolean isPauseable()- Specified by:
isPauseablein interfaceorg.springframework.context.SmartLifecycle
-
stop
public void stop()- Specified by:
stopin interfaceorg.springframework.context.Lifecycle
-
stop
- Specified by:
stopin interfaceorg.springframework.context.SmartLifecycle
-
close
public void close()- Specified by:
closein interfaceAutoCloseable
-