INVOKE Step
The INVOKE step is the most fundamental step type in Joynare Nexus. It is used to call other services, whether they are built-in system services, other Flow Services, or Adapter services.
Properties
| Property | Type | Description |
|---|---|---|
type | string | Must be invoke. |
service | string | The fully qualified name of the service (e.g., system.string:Uppercase). |
input | object | (Optional) Explicit field mappings for the service inputs. |
output | object | (Optional) Explicit field mappings for the service results. |
Mapping Logic
The INVOKE step uses a powerful "Mixed Mode" mapping system to move data between the Pipeline and the service.
1. Input Mapping
When calling a service, you can provide data in three ways:
- Automatic: If a pipeline field name matches a service input name.
- Explicit: Using
${pipelineField}to map a specific pipeline variable. - Literal: Providing a fixed value directly in the YAML.
2. Output Mapping
When a service returns, its results are merged back into the pipeline:
- Full Merge (Default): If no
outputis defined, all results are added to the pipeline. - Explicit Rename: Use the
outputproperty to map a result field to a different name in the pipeline.
Example: Calling a String Service
yaml
- name: "ConvertName"
type: "invoke"
service: "system.string:Uppercase"
input:
text: "${firstName}" # Explicitly map 'firstName' to 'text'
output:
result: "upperName" # Map 'result' from service to 'upperName' in pipelineData Flow
Initial Pipeline:
json
{ "firstName": "john" }Service Execution:
- Input to
Uppercase:{ "text": "john" } - Result from
Uppercase:{ "result": "JOHN" }
Resulting Pipeline:
json
{
"firstName": "john",
"upperName": "JOHN"
}(Note: 'firstName' remains, and 'upperName' is added based on the output mapping)
Types of Services You Can Invoke
- Built-in Services: Core functions provided by the ESB (e.g.,
system.math,system.json). - Flow Services: Other YAML-defined workflows (nested flows).
- Adapter Services: Direct interactions with databases or external APIs.
Tips
- Encapsulation: Use INVOKE to call small, reusable Flow Services to keep your main flows clean.
- Validation: Ensure the service name is correctly qualified with its namespace.
- Error Handling: If an invoked service fails, the error will bubble up to the parent flow unless handled by a SEQUENCE step.
