Lemline documentation Help

"Wait for payments and collect order checks

A wait pauses an existing instance for a duration. A listen pauses it until matching events arrive. The runner persists pending operations so it can resume an instance after a restart.

Run the commands from the setup directory. With the JAR, replace bin/lemline with java -jar lemline.jar. In PowerShell, use .\bin\lemline.exe.

Prepare the runner

Follow the SQLite setup to prepare a local runner that serves the examples namespace. Leave the worker running. This exercise uses SQLite events and can run independently of the shop.

Resume after a duration

Save the definition as delayed-processing.yaml. Its first task waits 30 seconds. The next task returns a resumed state.

document: dsl: '1.0.3' namespace: examples name: delayed-processing version: '1.0.0' do: - pause: wait: PT30S - resume: set: state: resumed
bin/lemline definition post -f delayed-processing.yaml bin/lemline instance start examples delayed-processing

Publish test events

Save this definition as tutorial-publisher.yaml and register it. It publishes the event type and data supplied as workflow input through the same SQLite messaging channel as the runner.

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 }
bin/lemline definition post -f tutorial-publisher.yaml

Resume when a payment arrives

Register the next definition and start it with an order ID in the workflow input. Publish an event of type com.example.payment.received with the same orderId in its payload. A payment for another order leaves this instance waiting.

document: dsl: '1.0.3' namespace: examples name: listen-for-payment version: '1.0.0' do: - awaitPayment: listen: to: one: with: type: com.example.payment.received correlate: orderId: from: ${ .orderId } expect: ${ $workflow.input.orderId } timeout: after: PT30M

Save the definition as listen-for-payment.yaml and run:

bin/lemline definition post -f listen-for-payment.yaml bin/lemline instance start examples listen-for-payment --input '{"orderId":"ORD-123"}'

Once the listener is waiting, publish these events in order:

bin/lemline instance start examples tutorial-publisher --input '{"type":"com.example.payment.received","data":{"orderId":"OTHER"}}' bin/lemline instance start examples tutorial-publisher --input '{"type":"com.example.payment.received","data":{"orderId":"ORD-123"}}'

Collect multiple results

Start an instance of this workflow and publish an inventory check and shipping quote. The listener waits for both types before continuing.

document: dsl: '1.0.3' namespace: examples name: listen-for-all-results version: '1.0.0' do: - collectResults: listen: to: all: - with: type: com.example.inventory.checked - with: type: com.example.shipping.quoted timeout: after: PT5M - recordResults: set: checks: ${ . }

Save the definition as listen-for-all-results.yaml. Start the listener, then publish both events after it is waiting:

bin/lemline definition post -f listen-for-all-results.yaml bin/lemline instance start examples listen-for-all-results bin/lemline instance start examples tutorial-publisher --input '{"type":"com.example.inventory.checked","data":{"stock":2}}' bin/lemline instance start examples tutorial-publisher --input '{"type":"com.example.shipping.quoted","data":{"price":15}}'

After both events arrive, the instance completes with both results in checks. Continue with Monitor the warehouse temperature.

See Event Correlation and Timeouts for matching and bounded waits.

25 November 2026