Interaction
Description
The Interaction node (interaction) pauses the execution of a Request-Response scenario. When a request reaches the node:
- the current state of the execution (all variables available at the node) is stored under a new, unique
continuationId, - the scenario immediately returns the Early response to the caller - this is the HTTP response of the original request,
- the nodes after the Interaction node are executed only when the scenario is resumed with a call to its
/resumeendpoint, carrying thecontinuationIdand additional input. The response of the/resumecall is the response produced by the scenario after the Interaction node.
It is useful for multi-step interactions, e.g. returning a preliminary decision and asking the caller for a confirmation, a missing piece of data or a one-time code before the processing continues.
Parameters and configuration
| Name | Description |
|---|---|
| Early response | Response returned to the caller when the execution pauses at this node. Include #continuationId in it - the caller needs this id to resume the scenario, and it is returned nowhere else. #scenarioVersionId (a String) is available too. |
| Output variable name | The name of the variable holding the additional input sent in the /resume call (a String). |
In the Early response expression two additional variables are available:
| Variable | Description |
|---|---|
#continuationId | Unique, single-use identifier of the paused execution (a String). |
#scenarioVersionId | The version of the scenario that paused the execution (a String). |
After the node, all variables available before the node (e.g. #input) are restored, and the output variable holds the additional input of the /resume call.
Resuming the scenario
The scenario is resumed with a POST request to the /resume path of the scenario's endpoint (the scenario's invocation URL followed by /resume), with a JSON body:
{
"continuationId": "a7f1c2e4-...",
"additionalInput": "confirmed"
}
| Field | Description |
|---|---|
continuationId | The id returned in the early response. |
additionalInput | A String passed to the scenario in the Interaction node's output variable. To pass structured data, send a JSON document as a string and parse it in the scenario. |
/resumeis secured the same way as the main endpoint of the scenario - if Basic Auth is configured for the scenario,/resumerequires it too; a validcontinuationIdalone is not enough.- A
continuationIdcan be used only once. Two/resumecalls with the same id - even concurrent ones - resume the execution at most once; the other one gets400. Treat/resumeas non-idempotent: retrying it after a timeout may find the continuation already consumed. - A
/resumecall with an unknowncontinuationIdgets400with a message explaining that the id was never issued, has already been resumed, has expired, or was dropped because the cache of paused executions was full. - The
/resumeoperation is included in the scenario's OpenAPI definition.
Example
A payment scenario asks the customer to confirm a large transfer:
- Early response:
{
"status": "CONFIRMATION_REQUIRED",
"continuationId": #continuationId
} - Output variable name:
confirmation
After the Interaction node, a Choice node checks #confirmation == 'confirmed' and leads to Response nodes returning {"status": "EXECUTED"} or {"status": "CANCELLED"}. #input (the original request) is still available there.
The caller first sends the payment request and receives {"status": "CONFIRMATION_REQUIRED", "continuationId": "..."}, then calls /resume with this continuationId and "additionalInput": "confirmed", and receives {"status": "EXECUTED"}.
Testing
In scenario tests (test cases) the Interaction node can be mocked: the mock value is used as the node's output variable (the resumed input), so the whole flow, including the part after the Interaction node, is executed in one test run.
Additional considerations
- Paused executions are kept in memory of the runtime, for at most
request-response.continuationTtl(default 5 minutes) and up torequest-response.continuationMaxCacheSizeentries (default100000); when the cache is full, the oldest paused execution is dropped. A paused execution is lost when the runtime is restarted. - Behaviour around redeployments and on Kubernetes (single replica required, no draining) differs per engine - see the Lite operations guide. The component can be disabled on an environment with
componentsUiConfig.interaction.disabled: true.