Class EsbTriggerHandler

java.lang.Object
com.kingsrook.qqq.esb.runtime.EsbTriggerHandler

public class EsbTriggerHandler extends Object
Runs a trigger's process for ESB events (spec section 6), plus the per-message helpers that EsbTriggerRunner uses around a run: the attempt number, backoff, error text, and dead-letter messages. runProcess is one triggered run. It is also what a dead-letter replay calls, so it can be called from any thread, including one that has a QContext of its own (which it puts back when done). A run: - uses a QContext with the handler's instance and the trigger's run-as session (runAsSessionSupplier, or a QSystemUserSession by default); - checks the session's permission to the process (QPermissionDeniedException if denied); - runs the process with FrontendStepBehavior.SKIP, and the events as the esbMessages value (an ArrayList of EsbEvent; size 1 in SINGLE mode); - when the process has a table, and some events are from that table (their source is qqq://instance/table/thatTable), sets a QProcessCallback whose filter is primaryKey IN (those events' subjects) - so a table-bound process runs on the changed records, as it would when run on selected records; - in SINGLE mode, sets EsbCausation to the event's id for the run, so events published during the run point back at it. BATCH runs (one run, many causes) leave causation as it was. A failed run throws: the process's exception, as RunProcessAction throws it.
  • Field Details

  • Constructor Details

    • EsbTriggerHandler

      public EsbTriggerHandler(QInstance qInstance)
      Constructor - for runs against this instance.
  • Method Details

    • runProcess

      public void runProcess(EsbTrigger trigger, String processName, List<EsbEvent> events) throws Exception
      Run the trigger's process (processName - the process the trigger is on) for some events: see the class comment. Throws if the run fails.
      Throws:
      Exception