Class StreamAuditEventListener
- java.lang.Object
-
- org.nuxeo.ecm.platform.audit.listener.StreamAuditEventListener
-
- All Implemented Interfaces:
javax.transaction.Synchronization
,EventListener
public class StreamAuditEventListener extends Object implements EventListener, javax.transaction.Synchronization
An events collector that write log entries as json record into a stream.- Since:
- 9.3
-
-
Field Summary
Fields Modifier and Type Field Description static String
DEFAULT_LOG_CONFIG
Deprecated.protected static ThreadLocal<List<LogEntry>>
entries
protected static ThreadLocal<Boolean>
isEnlisted
static String
STREAM_AUDIT_ENABLED_PROP
static String
STREAM_NAME
protected static AtomicInteger
writeCounter
-
Constructor Summary
Constructors Constructor Description StreamAuditEventListener()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
afterCompletion(int status)
protected String
asJson(LogEntry entry)
void
beforeCompletion()
protected String
getPartitionKey()
protected StreamManager
getStreamManager()
protected long
getTimestampForEntry(LogEntry entry)
void
handleEvent(Event event)
Handle the given event.protected Record
recordOf(String partitionKey, LogEntry entry)
protected Record
recordOf(LogEntry entry)
protected boolean
registerSynchronization(javax.transaction.Synchronization sync)
protected void
writeEntries()
-
-
-
Field Detail
-
isEnlisted
protected static final ThreadLocal<Boolean> isEnlisted
-
entries
protected static final ThreadLocal<List<LogEntry>> entries
-
STREAM_AUDIT_ENABLED_PROP
public static final String STREAM_AUDIT_ENABLED_PROP
- See Also:
- Constant Field Values
-
STREAM_NAME
public static final String STREAM_NAME
- See Also:
- Constant Field Values
-
writeCounter
protected static final AtomicInteger writeCounter
-
DEFAULT_LOG_CONFIG
@Deprecated public static final String DEFAULT_LOG_CONFIG
Deprecated.- See Also:
- Constant Field Values
-
-
Method Detail
-
handleEvent
public void handleEvent(Event event)
Description copied from interface:EventListener
Handle the given event. The listener can cancel the event by callingEvent.cancel()
- Specified by:
handleEvent
in interfaceEventListener
- Parameters:
event
- the event
-
beforeCompletion
public void beforeCompletion()
- Specified by:
beforeCompletion
in interfacejavax.transaction.Synchronization
-
afterCompletion
public void afterCompletion(int status)
- Specified by:
afterCompletion
in interfacejavax.transaction.Synchronization
-
writeEntries
protected void writeEntries()
-
getPartitionKey
protected String getPartitionKey()
-
getTimestampForEntry
protected long getTimestampForEntry(LogEntry entry)
-
registerSynchronization
protected boolean registerSynchronization(javax.transaction.Synchronization sync)
-
getStreamManager
protected StreamManager getStreamManager()
-
-