Class EsbEventFactory

java.lang.Object
com.kingsrook.qqq.esb.envelope.EsbEventFactory

public class EsbEventFactory extends Object
Makes the EsbEvents that QQQ publishes (spec section 4). Every event gets a new UUID id, the current time, and the current thread's EsbCausation id as its causationId. Sources are qqq://instanceName/path; a null instance name leaves the authority empty (qqq:///path). Table events (type qqq.table.tableName.inserted|updated|deleted) have the record's primary key as their subject, and data holding copies of the records' field values (QRecord.getValues()): - INSERT: { record } - UPDATE: { record, oldRecord }, where record is the full post-update record: the old record's values overlaid with the updated values (the records a record change listener gets hold only the fields that were sent). Without an old record, data is { record } with just the updated values. - DELETE: { oldRecord } Process events (type qqq.process.processName.started|completed|failed) have data { processName, processUUID, error? }.
  • Field Details

  • Constructor Details

    • EsbEventFactory

      public EsbEventFactory()
  • Method Details

    • forRecordChange

      public static EsbEvent forRecordChange(String instanceName, String tableName, RecordChangeType changeType, QRecord record, QRecord oldRecord)
      An event for one record written by an insert, update, or delete. record is the record as the action wrote it; oldRecord is the stored record from before the write (null for an insert, and allowed to be null for an update or a delete). The subject is the primary key, found through the table's meta-data in the QContext's instance (null if either is missing). Throws IllegalArgumentException if there's no record to describe.
    • forRecordChange

      public static EsbEvent forRecordChange(String instanceName, String tableName, RecordChangeType changeType, QRecord record, QRecord oldRecord, boolean includeClassified)
      Explicit per-publication opt-in; default callers omit classified values.
    • forProcess

      public static EsbEvent forProcess(String instanceName, String processName, EsbProcessEvent processEvent, String processUUID, String error)
      An event for a process run starting, completing, or failing. error is the failure's message (null when there is none), and is left out of data when null.
    • custom

      public static EsbEvent custom(String instanceName, String sourcePath, String type, Map<String,Serializable> data)
      An explicitly published event, with a caller-supplied type and data (copied; null means empty). sourcePath is what follows the instance name in the source (e.g., process/syncOrder); a leading slash is ignored. Throws IllegalArgumentException if type is empty.