"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.
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.
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.
Save the definition as listen-for-payment.yaml and run:
Once the listener is waiting, publish these events in order:
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.
Save the definition as listen-for-all-results.yaml. Start the listener, then publish both events after it is waiting:
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.