Skip to main content

Process Definition

The ProcessDefinition class serves as the blueprint for defining processes within the Unmeshed system. It encapsulates all necessary information required to build Directed Acyclic Graphs (DAGs) that form workflows or complex process definitions, enabling their execution and management.

Overview

ProcessDefinition is utilized to construct workflows by defining a series of interconnected steps. Each step is represented by a Step Definition, letting you create a DAG of any depth representing any complex flows that you need to implement. This data model ensures that all essential aspects of a process, such as configuration, inputs, outputs, and hierarchical relationships between steps, are systematically organized and accessible.

Fields

FieldTypeDescription
namespaceStringNamespace used to group related processes, aiding in organization and access control.
nameStringThe name of the process definition, used for identification and reference within the system.
versionIntegerVersion number of the process definition, allowing for version control and updates.
typeProcessTypeThe type of process, categorizing it within the system's process taxonomy.
descriptionStringA brief description of the process, outlining its purpose and functionality.
createdByStringUsername or identifier of the user who created the process definition.
updatedByStringUsername or identifier of the user who last updated the process definition.
createdlongEpoch timestamp marking when the process definition was created.
updatedlongEpoch timestamp marking when the process definition was last updated.
configurationProcessConfigurationConfiguration settings specific to the process, defining operational parameters and behaviors.
stepsList<StepDefinitionDTO>List of steps that make up the process, each defined by a (Step Definition).
defaultInputMap<String, Object>Default input values provided to the process, used if no specific inputs are supplied during execution.
defaultOutputMap<String, Object>Default output values generated by the process, serving as fallback outputs if not overridden by steps.

Process Workflow

The ProcessDefinition facilitates the creation of workflows by defining a sequence of steps (Step Definition). These steps can be arranged in various configurations, such as sequential execution, parallel execution, conditional branching, and iterative loops, forming a Directed Acyclic Graph (DAG) that dictates the flow of the process.

Key Components:

  • Steps: Individual units of work within the process, each performing specific tasks.
  • Hierarchy: Steps can have child steps, allowing for nested workflows and complex process structures.
  • Configuration: Each step and the overall process can be configured to control behavior, error handling, caching, and more.
tip

As we evolved from Conductor, we are no longer restricting the level of nesting in the workflow definitions. This allows for greater flexibility to define processes

Usage Examples

Example: Defining a Simple Sequential Process

A process that fetches user data, processes it, and then validates the results.

{
"namespace": "default",
"name": "order_flow",
"version": 1,
"type": "API_ORCHESTRATION",
"steps": [
{
"orgId": 1,
"namespace": "default",
"name": "getCustomerDetail",
"type": "HTTP",
"ref": "customerDetails",
"optional": false,
"input": {
"method": "GET",
"url": "http://localhost:8080/api/test/get",
"headers": {
"Content-Type": "application/json",
"Accept": "application/json",
"Authorization": "Bearer test"
},
"params": {
"customerEmail": "{{ context.input.customerEmail }} "
}
}
},
{
"namespace": "default",
"name": "getOrderList",
"type": "HTTP",
"ref": "orderList",
"optional": false,
"input": {
"method": "GET",
"url": "http://localhost:8080/api/test/get",
"headers": {
"Content-Type": "application/json",
"Accept": "application/json",
"Authorization": "Bearer {{ secrets.orderServiceKey }}"
},
"params": {
"customerId": "{{ steps.customerDetails.output.response.id }}"
}
}
},
{
"namespace": "default",
"name": "new_javascript",
"type": "JAVASCRIPT",
"ref": "new_javascript_1",
"optional": false,
"input": {
"script": "// (steps, context) will be provided as default inputs \n(steps, context) => {\n return {\n \"formattedOutput\" : steps.orderList.output.response,\n \"customerId\" : steps.customerDetails.output.response.id\n }\n}"
}
}
],
"defaultInput": null,
"defaultOutput": null
}

Best Practices

  • Consistent Naming Conventions: Use clear and descriptive names for namespaces, processes, and steps to enhance readability and maintainability.
  • Version Control: Maintain versioning for process definitions to track changes and facilitate rollback if necessary.
  • Access Control: Utilize namespaces effectively to manage access permissions, ensuring that only authorized users can modify or execute certain processes.
  • Performance Optimization: Leverage caching and priority settings in configurations to optimize the performance of critical processes.