Class QEsbRuntime

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

public class QEsbRuntime extends Object
The ESB trigger runtime on this node: one EsbTriggerRunner for each trigger (EsbProcessMetaData.triggers) in an instance. An app starts it at startup and stops it at shutdown, as it does the scheduler: QEsbRuntime.getInstance().start(qInstance); ... QEsbRuntime.getInstance().stop(); getInstance is the node's usual runtime. More can be made with the constructor (e.g., tests that act as two nodes on one broker). start takes a validated instance, as an app has at boot (as with the scheduler): the runtime's threads each put it in their QContext, which would otherwise validate it on each of them at once. An unvalidated one is refused (IllegalArgumentException). EsbInstanceMetaData.enrich registers EsbRuntimeService, so an application launcher starts and stops the node's runtime (getInstance) along with its server. Each start also opens an EsbControlChannel, which listens on the control topic of each provider its triggers use, and applies the pause, resume and restart messages that EsbTriggerControl sends (from any node) to this runtime's runners. start never blocks, even with the broker down: the runners connect on their own threads, wait in CONNECTING while they can't, and rebuild their consumers when EsbConnectionManager reports a reconnect. Triggers with startPaused start PAUSED. A trigger whose destination isn't in the instance's ESB meta-data (which validation reports) is skipped, with a warning. stop interrupts runs in progress and rolls their messages back (see EsbTriggerRunner), and waits up to 10 s for the consumers to close. The runners stay available (getRunner, getRunners), STOPPED, until the next start, which makes new ones. The provider connections stay open: they belong to EsbConnectionManager, and publishing shares them.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Constructor - for a runtime of your own; most apps use getInstance.
  • Method Summary

    Modifier and Type
    Method
    Description
    This node's usual runtime.
    getRunner(String triggerName)
    The runner for a trigger (by its name, processName.destinationName) - or null if the last start had no such trigger.
    All the runners from the last start (in process, then trigger, order).
    Whether this runtime is started and its control subscriptions are ready.
    void
    start(QInstance qInstance)
    Start a runner for each trigger in the (validated) instance, and the control channel.
    void
    Stop every runner: runs in progress are interrupted and their messages rolled back.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • QEsbRuntime

      public QEsbRuntime()
      Constructor - for a runtime of your own; most apps use getInstance.
  • Method Details

    • getInstance

      public static QEsbRuntime getInstance()
      This node's usual runtime.
    • start

      public void start(QInstance qInstance)
      Start a runner for each trigger in the (validated) instance, and the control channel. Doesn't block. Ignored (with a warning) if this runtime is already running.
    • stop

      public void stop()
      Stop every runner: runs in progress are interrupted and their messages rolled back. Waits (up to 10 s) for the consumers to close. No-op if not running.
    • isRunning

      public Boolean isRunning()
      Whether this runtime is started and its control subscriptions are ready. A non-durable command sent before a subscription exists would be lost, so startup and a disconnected provider do not report RUNNING.
    • getRunner

      public EsbTriggerRunner getRunner(String triggerName)
      The runner for a trigger (by its name, processName.destinationName) - or null if the last start had no such trigger.
    • getRunners

      public List<EsbTriggerRunner> getRunners()
      All the runners from the last start (in process, then trigger, order).