Class EsbStatusBuilder

java.lang.Object
com.kingsrook.qqq.esb.api.EsbStatusBuilder

public class EsbStatusBuilder extends Object
Builds the bodies of the ESB endpoints (see the specs in the specs package), as maps in exactly the shape of the endpoint contract, from the QContext's instance and session: ESB meta-data, this node's counters (EsbStats) and trigger states (QEsbRuntime), and broker data from the management API when a provider has a managementUrl. Checks permissions (throwing QPermissionDeniedException), and throws QNotFoundException for an unknown table, process, trigger or destination, or a table or process without ESB meta-data. Never includes a provider's urls or credentials. One builder per request: it keeps the broker adapters and queue infos it looked up, so each queue is asked about once.
  • Field Details

    • DEFAULT_LIMIT

      public static final Integer DEFAULT_LIMIT
    • MAX_LIMIT

      public static final Integer MAX_LIMIT
      /////////////////////////////////////////////////////////////////
  • Constructor Details

    • EsbStatusBuilder

      public EsbStatusBuilder()
      Constructor - for the QContext's instance (and, for permissions, session).
  • Method Details

    • buildTable

      public Map<String,Object> buildTable(String tableName) throws QException
      GET /table/{table}: the table's publications, the triggers subscribed to their destinations (on processes the user can access), and permissions. Needs READ on the table.
      Throws:
      QException
    • buildProcess

      public Map<String,Object> buildProcess(String processName) throws QException
      GET /process/{process}: the process's publications and triggers, and permissions. Needs access to the process.
      Throws:
      QException
    • buildOverview

      public Map<String,Object> buildOverview() throws QException
      GET /overview: the providers (name, type, connected, managementEnabled - never urls or credentials), every destination with its publishers and its triggers (on processes the user can access), and permissions. Needs access to the ESB app (esbView).
      Throws:
      QException
    • browseDeadLetters

      public Map<String,Object> browseDeadLetters(String triggerName, Integer offset, Integer limit) throws QException
      GET /deadLetters/{trigger}: a page of the trigger's dead-letter queue. Needs access to the trigger's process.
      Throws:
      QException
    • browseMessages

      public Map<String,Object> browseMessages(String destinationName, String triggerName, Integer offset, Integer limit) throws QException
      GET /messages/{destination}: a page of a queue's messages - or, for a topic, of one of its triggers' subscription queues (named by triggerName; required for a topic, ignored for a queue). Needs esbView, or READ on a table that publishes to the destination, or access to a process that it triggers. A topic subscription requires access to its selected trigger's process unless the user has service-level ESB view access.
      Throws:
      QException
    • withRuntime

      public EsbStatusBuilder withRuntime(QEsbRuntime runtime)
      Fluent setter for the runtime whose trigger states are reported (by default, QEsbRuntime.getInstance()).