Class AsyncEventService

java.lang.Object
org.imixs.workflow.engine.AsyncEventService

@DeclareRoles({"org.imixs.ACCESSLEVEL.NOACCESS","org.imixs.ACCESSLEVEL.READERACCESS","org.imixs.ACCESSLEVEL.AUTHORACCESS","org.imixs.ACCESSLEVEL.EDITORACCESS","org.imixs.ACCESSLEVEL.MANAGERACCESS"}) @RolesAllowed({"org.imixs.ACCESSLEVEL.NOACCESS","org.imixs.ACCESSLEVEL.READERACCESS","org.imixs.ACCESSLEVEL.AUTHORACCESS","org.imixs.ACCESSLEVEL.EDITORACCESS","org.imixs.ACCESSLEVEL.MANAGERACCESS"}) public class AsyncEventService extends Object
The AsyncEventService can be used to process workflow events in an asynchronous batch process. The AsyncEventService lookup eventLog entries of the topic "async.event".

The processor look up the workItem and starts a processing life cycle.

The AsyncEventService is called only by the AsyncEventScheduler which is implementing a ManagedScheduledExecutorService.

To prevent concurrent processes to handle the same workitems the batch process uses a Optimistic lock strategy. After fetching new event log entries the processor updates the eventLog entry in a new transaction and set the topic to 'batch.process.lock'. After that update we can be sure that no other process is dealing with these entries. After completing the processing step the eventlog entry will be removed.

To avoid ad deadlock the processor set an expiration time on the lock, so the lock will be auto-released after 1 minute (batch.processor.deadlock).

Version:
1.0
Author:
rsoika
See Also:
  • Constructor Details

    • AsyncEventService

      public AsyncEventService()
  • Method Details

    • onProcess

      public void onProcess(@Observes ProcessingEvent processingEvent) throws ModelException
      The observer method verifies if the current task contains a AsyncEvent definition.
      Throws:
      ModelException
    • processEventLog

      public void processEventLog()
      The method lookups for batch event log entries and processed workitems in a batch process.

      Each eventLogEntry is cached in the eventCache. The cache is cleared from all eventLogEntries not part of the current collection. We can assume that the event was succefully processed by the ArchiveHandler

      Throws:
      ArchiveException