public class EventLogService extends Object
An event that occurs during an update or a processing function within a transaction becomes a fact when the transaction completes successfully. The EventLogService can be used to store this kind of "Change Data Capture" events in a log. An example is the LuceneUpdateService, which should update the index of a document only if the document was successfully written to the database.
The service is bound to the current PersistenceContext and stores a EventLog entity directly in the database to represent an event. These types of events can be queried by clients through the service.
The EventLogService provides a lock/unlock mechanism. An eventLog entry can optional be locked for processing. The topic of the event will be suffixed with '.lock' to indicate that this topic is locked by a running process. If a lock is successful a client can exclusive process this eventLog entry.
The method releaseDeadLocks unlocks eventlog entries which are older than 1 minute. We assume that these events are deadlocks.
EventLog,
UpdateService| Modifier and Type | Field and Description |
|---|---|
static String |
EVENTLOG_LOCK_DATE |
| Constructor and Description |
|---|
EventLogService() |
| Modifier and Type | Method and Description |
|---|---|
EventLog |
createEvent(String topic,
String refID)
Creates/updates a new event log entry.
|
EventLog |
createEvent(String topic,
String refID,
Calendar timeout)
Creates/updates a new event log entry.
|
EventLog |
createEvent(String topic,
String refID,
ItemCollection document)
Creates/updates a new event log entry.
|
EventLog |
createEvent(String topic,
String refID,
ItemCollection document,
Calendar timeout)
Creates/updates a new event log entry.
|
EventLog |
createEvent(String topic,
String refID,
Map<String,List<Object>> data,
Calendar timeout)
Creates/updates a new event log entry.
|
List<EventLog> |
findAllEvents(int firstResult,
int maxResult)
Returns all event log entries
|
List<EventLog> |
findEventsByRef(int maxCount,
String ref,
String... topic)
Finds events for one or many given topics assigned to a given document
reference ($uniqueId).
|
List<EventLog> |
findEventsByTimeout(int maxCount,
String... topic)
Finds events for one or many given topics within the current timeout.
|
List<EventLog> |
findEventsByTopic(int maxCount,
String... topic)
Finds events for one or many given topics
|
EventLog |
getEvent(String id)
Returns an detached event log entry by its ID.
|
boolean |
lock(EventLog _eventLogEntry)
This method locks an eventLog entry for processing.
|
void |
releaseDeadLocks(long deadLockInterval,
String... topic)
This method unlocks eventlog entries which are older than 1 minute.
|
void |
removeEvent(EventLog _eventLog)
Deletes an existing eventLog.
|
void |
removeEvent(String id)
Deletes an existing eventLog by its id.
|
boolean |
unlock(EventLog _eventLogEntry)
This method unlocks an eventLog entry.
|
public static final String EVENTLOG_LOCK_DATE
public EventLog createEvent(String topic, String refID)
refID - - uniqueid of the document to be assigned to the eventtopic - - the topic of the event.public EventLog createEvent(String topic, String refID, Calendar timeout)
refID - - uniqueid of the document to be assigned to the eventtopic - - the topic of the event.timeout - - optional timeout calendar objectpublic EventLog createEvent(String topic, String refID, ItemCollection document)
refID - - uniqueId of the document to be assigned to the eventtopic - - the topic of the event.document - - optional document providing a data mappublic EventLog createEvent(String topic, String refID, ItemCollection document, Calendar timeout)
refID - - uniqueId of the document to be assigned to the eventtopic - - the topic of the event.document - - optional document providing a data maptimeout - - optional timeout calendar objectpublic EventLog createEvent(String topic, String refID, Map<String,List<Object>> data, Calendar timeout)
refID - - uniqueId of the document to be assigned to the eventtopic - - the topic of the event.data - - optional data mappublic List<EventLog> findEventsByTopic(int maxCount, String... topic)
maxCount - - maximum count of events to be returnedtopic - - list of topicspublic List<EventLog> findEventsByTimeout(int maxCount, String... topic)
The attribte 'timeout' is optional. If the timeout is set to a future point of time, the event will be ignored by this method.
maxCount - - maximum count of events to be returnedtopic - - list of topicspublic List<EventLog> findEventsByRef(int maxCount, String ref, String... topic)
maxCount - - maximum count of events to be returnedref - - a reference ID for an assigned Document or Workitem
instancetopic - - list of topicspublic List<EventLog> findAllEvents(int firstResult, int maxResult)
firstResult - - first resultmaxResult - - maximum count of events to be returnedpublic void removeEvent(EventLog _eventLog)
eventLog - public void removeEvent(String id)
eventLog - public EventLog getEvent(String id)
id - - id of the eventLog Entrypublic boolean lock(EventLog _eventLogEntry)
The method adds a item 'eventlog.lock.date' with a timestamp. This timestamp is used by the method 'autoUnlock' to release locked entries.
eventLogEntry - public boolean unlock(EventLog _eventLogEntry)
eventLogEntry - public void releaseDeadLocks(long deadLockInterval,
String... topic)
Copyright © 2006–2020 Imixs Software Solutions GmbH. All rights reserved.