Skip to main content
Version: Current

Interaction

Mode: Request-Response

Description​

The Interaction node (interaction) pauses the execution of a Request-Response scenario. When a request reaches the node:

  1. the current state of the execution (all variables available at the node) is stored under a new, unique continuationId,
  2. the scenario immediately returns the Early response to the caller - this is the HTTP response of the original request,
  3. the nodes after the Interaction node are executed only when the scenario is resumed with a call to its /resume endpoint, carrying the continuationId and additional input. The response of the /resume call 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​

NameDescription
Early responseResponse 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 nameThe 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:

VariableDescription
#continuationIdUnique, single-use identifier of the paused execution (a String).
#scenarioVersionIdThe 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"
}
FieldDescription
continuationIdThe id returned in the early response.
additionalInputA 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.
  • /resume is secured the same way as the main endpoint of the scenario - if Basic Auth is configured for the scenario, /resume requires it too; a valid continuationId alone is not enough.
  • A continuationId can be used only once. Two /resume calls with the same id - even concurrent ones - resume the execution at most once; the other one gets 400. Treat /resume as non-idempotent: retrying it after a timeout may find the continuation already consumed.
  • A /resume call with an unknown continuationId gets 400 with 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 /resume operation 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 to request-response.continuationMaxCacheSize entries (default 100000); 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.