Skip to main content
Schedule functions to execute at specific times using cron expressions.

Sample Configuration

Configuration

Adapter
The adapter to use for distributed locking. Defaults to modules::cron::KvCronAdapter. Use RedisCronAdapter for multi-instance deployments.

Adapters

modules::cron::KvCronAdapter

When running multiple engine instances, KvCronAdapter does not provide reliable distributed locking — the same cron job may execute on every instance simultaneously. Use RedisCronAdapter for multi-instance deployments.
Built-in adapter using process-local locks. Suitable for single-instance deployments.

Configuration

integer
Duration in milliseconds for which a lock is held before it expires. Defaults to 30000 (30 seconds).
string
Key namespace used to store lock entries in the KV store. Defaults to cron_locks.

modules::cron::RedisCronAdapter

Uses Redis for distributed locking to prevent duplicate job execution across multiple engine instances.

Configuration

string
The URL of the Redis instance to use for distributed locking.

Trigger Type

This Module adds a new Trigger Type: cron.

Sample Code

Common Cron Expressions

Distributed Execution

When running multiple iii Engine instances, the Cron Module uses distributed locking to ensure jobs execute only once: