3.3.4 Configure Timeout for Tasks

You can configure timeouts for worker tasks by specifying timeout options in the task definition. These timeout settings apply to custom worker tasks that are registered as task definitions.

They do not apply to MicroTx Workflows system tasks and operators, which are executed by MicroTx Workflows and may expose their own task-specific timeout or wait parameters.

Task definitions are used to register worker task types and define reusable defaults such as retries, timeout settings, input keys, and output keys. See Create a Task Definition.

When you create or update a task definition, configure one or more of the following timeout options:

  • Poll timeout: The maximum time, in seconds, that a task can remain in the SCHEDULED state without being picked up by a worker. If no worker polls the task within this time, the task is marked as TIMED_OUT. Use this option to detect worker capacity issues or a backlogged task queue. If set to 0, poll timeout is disabled.
  • Response timeout: The maximum time, in seconds, that a worker can hold a task without sending an update. If the worker polls the task but does not update the task status within this time, the task is marked as TIMED_OUT. Use this option to detect crashed workers, network failures, or workers that stopped responding. If the task needs more time, the worker should send an IN_PROGRESS update before the response timeout expires.
  • Timeout: The maximum time, in seconds, that the task can take to reach a terminal state after it starts execution. If the task does not complete within this time, it is marked as TIMED_OUT. Use this option to enforce the overall service-level agreement for a task. If set to 0, task timeout is disabled.
  • Timeout policy: Defines what MicroTx Workflows does when the task times out.
    • RETRY: Retries the task if retry attempts are still available.
    • TIME_OUT_WF: Marks the workflow as TIMED_OUT and terminates the workflow. This is the default timeout policy.
    • ALERT_ONLY: Records the timeout, but does not change the task or workflow execution state.

Ensure that timeout is greater than response timeout. If timeout is configured, MicroTx Workflows validates that the response timeout value is less than the timeout value.

Example task definition timeout configuration

{
  "name": "process_payment",
  "retryCount": 3,
  "retryLogic": "FIXED",
  "retryDelaySeconds": 10,
  "pollTimeoutSeconds": 60,
  "responseTimeoutSeconds": 120,
  "timeoutSeconds": 600,
  "timeoutPolicy": "RETRY"
}