Triggers design patterns ======================== Applications of type Triggers (see :ref:`application_types`) are implemented using the following design patterns. Queue design pattern +++++++++++++++++++++ The design of a Queue Application implies steps for: - Data discovery, - Data selection, - Parameters definition, - Data Item(s) creation, - Data Item(s) submission to the Processing Queue. An example of control flow is the following: .. uml:: !define DIAG_NAME Trigger Queue example !include includes/skins.iuml skinparam backgroundColor #FFFFFF skinparam componentStyle uml2 start :Discover Data; while (Are there Data objects?) is (yes) if (Does Data object satisfy processing criteria?) then (yes) :Define processing parameters; :Create Data Item; :Add Data Item to Processing Queue; else (no) endif endwhile (no) stop .. tip:: It's important to note that Queue Applications, when discovering and selecting data, deal with metadata only, leveraging an Opensearch catalog (see :ref:`da-catalog`). Stage-in data is not usually required. Pipe design pattern ++++++++++++++++++++ Since Pipe Applications are not developed by the Users but provided as a service by the platform, the design pattern is provided as an additional information, that can be used to understand its behaviour. A Pipe Application performs the following steps: - Data Items retrieval, - Data Items analysis, - Stand-alone Processing Application execution submission, - Stand-alone Processing Application execution monitor. An example of control flow is the following: .. uml:: !define DIAG_NAME Trigger Pipe example !include includes/skins.iuml skinparam backgroundColor #FFFFFF skinparam componentStyle uml2 start :Retrieve Data Items; while (Are there Data Item objects to process?) is (yes) if (Has Data Item a status 'in'?) then (yes) :Monitor execution status; if (Succedeed?) then (yes) :Update Data Item status to 'out'; else (no) :Update Data Item status to 'err'; endif else (no) if (Has Data Item a status 'queue'?) then (yes) :Check processing capacity; if (Is there processing capacity?) then (yes) :Extract information from Data Item; :Submit exection of a Stand-alone Processing Application; :Update Data Item status to 'in'; else (no) endif else (no) endif endif endwhile (no) stop