Documentation Index
Fetch the complete documentation index at: https://platform.docs.zenoo.com/llms.txt
Use this file to discover all available pages before exploring further.
Hub Domain Specific Language (DSL)
The Hub DSL provides an implementation model for expressing digital onboarding solutions in a concise manner without superfluous details. Letting developers focus on the business logic. In addition to the main purpose Hub DSL supports these objectives:- enables transparent handling of failures,
- facilitates working with data payloads, data mapping and transformation,
- bridges the gap between developers and domain experts using a common language.
- Context attributes for storing and working with JSON-like data
-
DSL commands implement the basic building blocks of a digital onboarding
- route represents user interactions
- exchange makes external calls using connectors
- http makes external calls using connectors
- workflow executes child workflows
- function executes child functions
- mapper used for data mappings and transformations
- sharable generates and manages sharable links
- success / error / decision / response terminates the current execution
- logging for DSL logging
- Flow control commands allow for conditional execution
- Logging and metrics logging from DSL and support metrics events
DSL Commands
Route
A route represents an interaction with a user. Typically, the goal is to display route-specific information and gather input from the user. A route is rendered by a Hub Client as a web page or mobile app screen, depending on the Hub Client implementation. A route is identified by its name and can be used in a workflow definition. A minimal definition specifies a route uri intended for a Hub Client.Definition and usage
It is possible provide a route definition inline within a workflow definition.Route Result
A route result is stored using a namespace attribute key.Exporting data
In order to pass route data, the export is used. Any JSON-like data can be exported, using context attributes or serializable values.Route check-point
A route can be marked as a check-point, meaning it is disabled to go back to the previous route.Terminal route
A terminal route marks the end of a workflow execution. The corresponding execution is terminated when a terminal route is executed. Also, a terminal route is marked as a check-point.Route functions
A route function allows a Hub Client to execute functions in the context of the given route. A Hub client executes a route function via Hub Client API. Some use-cases of route functions:- dynamic queries based on user input, like auto-complete,
- asynchronous data processing, like document OCR,
- communication between different execution.
- initial execution context for corresponding function execution
- namespace stores the result of a route function execution
Exchange
An exchange is a connector proxy. It makes external (API) calls using an HTTP connector or a custom connector. It provides the following tools for handling connector failures:- timeout, an exchange fails with an error if the connector does not respond within the specified timeout
- retry strategy, retries failed connector requests
async().
HTTP connector
It is possible to use built-in HTTP connector to make external calls, see more details.Custom connector
Optionally, an exchange can use a custom connector with config.Connector Development Guide For comprehensive guidance on developing custom connectors, see the Custom Connector Development Guide and Plugin Connector Development Guide.
Exchange Result
An exchange result is stored using a namespace attribute key.Result handlers
Anexchange command can specify one on more result handlers
onError()executed when the result is erroronSuccess()executed when the result is success
http connector provides additional handlers
onStatus(status)executed when response status code matches the givenstatus, the response body is passed as inputonResponse()executed for any response, the response entity (headers, status, payload) is passed as input
Exchange Timeout
It is possible to set an exchange timeout in seconds. The default value is 30 seconds. An exchange fails with an error if the underlying connector doesn’t respond within the specified timeoutExchange Retry strategies
An exchange uses a retry strategy to retry when a connector request fails. The default strategy uses fixed delays between retry attempts. The following retry strategies are available:Fixed backoff
Uses fixed delays between retry attempts, given a number of retry attempts and the backoff delay in seconds.- retry a number of retry attempts, the default is 5
- backoff a number of seconds between retries, the default is 5
Exponential backoff
Uses a randomized exponential backoff strategy, given a number of retry attempts and minimum and maximux backoff delays in seconds.- retry a number of retry attempts, the default is 5
- backoff a minimum delay between retry attempts, the default is 5
- maxBackoff a maximum delay between retry attempts, the default is 50
No retry
Does not retry when a connector request fails.function
- like workflow but without user interactions (route, workflow)
- can be executed asynchronously
- separate execution with different UUID, data passed using context and input
- name a function name
- input a function input
- context execution context for function execution
- namespace a namespace to store function result
- async() the function will be executed asynchronously
workflow
Executes a sub-workflow synchronously as a separate workflow execution with different UUID. Data is passed using context and input. Execution is terminated if sub-workflow terminates with terminal route.- name a workflow name
- input a workflow input
- context execution context for workflow execution
- namespace a namespace to store workflow result
mapper
An attribute mapper transforms an input into an attribute output using mapper expression, see Mapper. The output gets stored in a namespace if specified. Can be used for data transformations, calculations and providing default values etc.path
Executes apath (workflow snippet) specified by a name. A path is executed as part of the current execution and shares the same execution context.
It is only possible to reference a path defined within the same component as a workflow being executed.
Execution result
There are several ways of terminating an execution and specifying an execution resultsuccess()for a success result with payloaderror()for an error result with payloaddecision()for a success result with a decision and payloadresponsefor exposed function response- the result of the last command or expression
decision().
Terminates an execution successfully with a decision and payload
Exposed function response
Exposed functions can specify an HTTP response details, including body, headers and status code.Execution result handlers
Eachfunction and workflow command can specify one on more result handlers
onError()executed when the result is erroronSuccess()executed when the result is success or any decisiononDecision()executed when the result is a given decision
sharable
Generates a sharable token or a link with the token. A sharable token can be used for starting a new workflow or function execution. It is possible to specifies a sharable token manually. Otherwise, it is generated as 6 random alpha numerical characters.For comprehensive documentation on sharables including use cases, integration patterns, and API reference, see the Sharables GuideA token expires when a corresponding execution is terminated, unless the token is marked as
reusable().
- url if provided generates a link using the sharable token
- payload an attribute/payload to be shared
- function a name of function to execute, optionally execution input and context can be provided
- workflow a name of workflow to execute, optionally execution input and context can be provided
- latest() a workflow or function reference revision is resolved when sharable token is used (rather than fixed)
- expired() expires specified token
- reusable() the token does not expire after corresponding execution terminates
- namespace asynchronously stores the function or workflow execution result
- expireIn token will expire after specified duration (use ISO-8601 duration format, default is 24 hours)
function-name. The token gets stored in the token namespace.
workflow-name with input and context.
The link gets stored in the link namespace. The link will expire in 30 minutes.
application attribute and can be accessed using input.token token.
Exporting namespaces
A context attribute namespace can be exported and queried using Execution APILogging
It is possible to generate application logs from the DSL using thelog command
com.zenoo.hub.dsl.executor.DSLLogger class with the following format
Flow control
await
Blocks the current execution and waits until an attribute is set, e.g. by an asynchronous function, exchange or sharable token.match
Executes a DSL script definition when an expression evaluates as true. The expression can contain context attributes.exist
Executes a DSL script definition when an attribute is set.switch / case
The switch statement matches expression with cases and executes the matching case. It’s a fallthrough switch-case. You can share the same code for multiple matches or use the break command. It uses different kinds of matching like, collection case, regular expression case, closure case and equals case.loop-until
Executes a DSL script definition until an expression evaluates as true.Logging and metrics
Logging
It is possible to produce logging messages in the DSL for the purpose of tracking and trouble-shooting. The logging messages are logged as DEBUG messages viacom.zenoo.hub.dsl.executor.DSLLogger.
In addition, the log messages are stored as part of execution events.
Metrics
You can use the following commands in order for tracking visited interactions and their outputs.Meters
You can use themeter command to record named measurements with numeric values. Meters are useful for tracking usage, billing, and custom metrics. The execution context UUID is automatically included in the event.
value defaults to 1 and tags defaults to an empty map when omitted.
e.g.