Skip to content
Stand with Ukraine flag

Delay

Use this node to hold messages in memory for a configurable period before forwarding them — for example, debouncing a rapid sequence of state changes by delaying the first message until a quiet period has elapsed. The delay period can be fixed or resolved dynamically from message metadata or data.

  • Use period in seconds pattern — when enabled, extracts the delay period from the message using a template pattern. When disabled, uses the fixed Period in seconds value.
    • Period in seconds — fixed delay duration (integer).
    • Period in seconds pattern — supports ${metadataKey} and $[dataKey] to extract the delay from the message.
  • Maximum pending messages — maximum number of messages that can be held in memory simultaneously. If exceeded, the incoming message is routed via Failure.
  1. Check that the number of currently pending messages is below the configured maximum. If exceeded, route via Failure.
  2. Determine the delay period:
    • Pattern mode: extract from message using the configured pattern. If extraction fails or value is not parseable as an integer, route via Failure.
    • Fixed mode: use the configured Period in seconds value.
  3. Acknowledge the original message (removes it from the persistent queue).
  4. Store the message in memory for the delay duration.
  5. After the delay expires, forward the message via Success.
ConnectionCondition
SuccessDelay expired; message forwarded.
FailureMaximum pending messages exceeded, delay period pattern unresolvable, or unexpected error.
{ "periodInSeconds": 5, "useMetadataPeriodInSecondsPatterns": false, "maxPendingMsgs": 1000 }

Result: message held 5 seconds then forwarded via Success.


Metadata: { "delaySeconds": "10" }

{ "useMetadataPeriodInSecondsPatterns": true, "periodInSecondsPattern": "${delaySeconds}", "maxPendingMsgs": 1000 }

Result: delay of 10 seconds extracted from metadata.


Example 3 — Dynamic delay from message data

Section titled “Example 3 — Dynamic delay from message data”

Data: { "waitTime": "3" }

{ "useMetadataPeriodInSecondsPatterns": true, "periodInSecondsPattern": "$[waitTime]", "maxPendingMsgs": 1000 }

Result: delay of 3 seconds extracted from data.


Example 4 — Max pending messages exceeded → Failure

Section titled “Example 4 — Max pending messages exceeded → Failure”
{ "periodInSeconds": 60, "useMetadataPeriodInSecondsPatterns": false, "maxPendingMsgs": 5 }

State: 5 messages already pending. Result: routes via Failure — limit exceeded.

{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"title": "TbMsgDelayNodeConfiguration",
"type": "object",
"additionalProperties": false,
"properties": {
"periodInSeconds": { "type": "integer" },
"useMetadataPeriodInSecondsPatterns": { "type": "boolean" },
"periodInSecondsPattern": { "type": "string" },
"maxPendingMsgs": { "type": "integer" }
}
}