Lemline documentation Help

Time in workflows

Workflows can compare timestamps in expressions, resume after a duration or start on a schedule. Lemline persists pending work so it can resume after a runner restart.

Compare timestamps in jq

Use now for Unix time in seconds and fromdateiso8601 to convert an ISO 8601 UTC timestamp before comparing it.

document: dsl: '1.0.3' namespace: examples name: interpret-deadline version: '1.0.0' do: - markOverdue: if: ${ now >= (.deadline | fromdateiso8601) } set: overdue: true

Delay an existing workflow instance

Use an ISO 8601 duration in a wait task to pause before continuing. The runner resumes the same instance.

document: dsl: '1.0.3' namespace: examples name: delayed-processing version: '1.0.0' do: - pause: wait: PT30S - resume: set: state: resumed

Schedule new instances

Use schedule.cron when each matching time should start a new instance.

document: dsl: '1.0.3' namespace: examples name: scheduled-processing version: '1.0.0' schedule: cron: '0 9 * * 1-5' do: - startDailyReport: set: report: daily

Bound a wait for an event

Use timeout.after on a listen task to bound how long it waits. If the task times out, an enclosing try task can read the error and return a fallback.

document: dsl: '1.0.3' namespace: examples name: timeout-listen-fallback version: '1.0.0' do: - collectApproval: try: - waitForApproval: listen: to: one: with: type: com.example.request.approved timeout: after: PT30S catch: errors: with: type: https://open-workflow-specification.org/spec/1.0.0/errors/timeout do: - expireRequest: set: status: expired

See Supported Features for timeout behavior on other task types.

Run the Examples

Every example on this page is a complete workflow. Complete the SQLite setup, save each example under the file name used below, and run the commands from the setup directory. With the JAR, substitute java -jar lemline.jar for bin/lemline.

The event examples need the tutorial publisher. Save it as tutorial-publisher.yaml:

document: dsl: '1.0.3' namespace: examples name: tutorial-publisher version: '1.0.0' do: - publish: emit: event: with: type: ${ .type } source: https://events.example.com/tutorial data: ${ .data }

Keep the setup worker running and use a second terminal in the setup directory.

bin/lemline definition post -f tutorial-publisher.yaml bin/lemline definition post -f interpret-deadline.yaml bin/lemline instance start examples interpret-deadline --input '{"deadline":"2020-01-01T00:00:00Z"}' bin/lemline instance start examples interpret-deadline --input '{"deadline":"2999-01-01T00:00:00Z"}' bin/lemline definition post -f delayed-processing.yaml bin/lemline instance start examples delayed-processing bin/lemline definition post -f timeout-listen-fallback.yaml bin/lemline instance start examples timeout-listen-fallback bin/lemline definition post -f scheduled-processing.yaml bin/lemline instance start examples scheduled-processing sqlite3 orchestration.db "SELECT COUNT(*) FROM lemline_schedules"

Example

Expected result

interpret-deadline, past deadline

{"overdue":true}

interpret-deadline, future deadline

The input unchanged: the if skips the task

delayed-processing

{"state":"resumed"} 30 to 40 seconds later

timeout-listen-fallback

{"status":"expired"} 30 to 40 seconds later, with no approval event

scheduled-processing

instance start registers the schedule: the query counts one schedule. No instance runs before the next weekday at 9:00.

25 November 2026