Skip to main content
Provides a mechanism for workflows to await and react to external events, enabling event-driven behavior within workflow systems.

Properties

listen.to
eventConsumptionStrategy
required
Configures the event(s) the workflow must listen to.
listen.read
string
default:"data"
Specifies how events are read during the listen operation.Supported values:
  • data - Reads the event’s data
  • envelope - Reads the event’s envelope, including its context attributes
  • raw - Reads the event’s raw data
foreach
subscriptionIterator
Configures the iterator, if any, for processing each consumed event.
A listen task produces a sequentially ordered array of all the events it has consumed, and potentially transformed using foreach.output.as.When foreach is set, the configured operations for events must complete before moving on to the next one. As a result, consumed events should be stored in a First-In-First-Out (FIFO) queue while awaiting iteration.
Events consumed by an until clause should not be included in the task’s output. These events are used solely to determine when the until condition has been met, and they do not contribute to the result or data produced by the task itself.

Example

document:
  dsl: '1.0.3'
  namespace: test
  name: listen-example
  version: '0.1.0'
do:
  - callDoctor:
      listen:
        to:
          any:
          - with:
              type: com.fake-hospital.vitals.measurements.temperature
              data: ${ .temperature > 38 }
          - with:
              type: com.fake-hospital.vitals.measurements.bpm
              data: ${ .bpm < 60 or .bpm > 100 }

Build docs developers (and LLMs) love