Overview
An event filter is a mechanism used to selectively process or handle events based on predefined criteria, such as event type, source, or specific attributes. Event filters enable workflows to wait for and react to specific events, supporting event-driven architectures.Event Filter Object
A name/value mapping of the attributes filtered events must define. Supports both regular expressions and runtime expressions.
A name/definition mapping of the correlations to attempt when filtering events.
Event Properties
An event object typically includes details such as the event type, source, timestamp, and unique identifier along with any relevant data payload. The Cloud Events specification, favored by Serverless Workflow, standardizes this structure to ensure interoperability across different systems and services.Identifies the event.
source + id is unique for each distinct event.Required when emitting an event using emit.event.with.An URI formatted string, or runtime expression, that identifies the context in which an event happened.
source + id is unique for each distinct event.Required when emitting an event using emit.event.with.Describes the type of event related to the originating occurrence.Required when emitting an event using
emit.event.with.A string, or runtime expression, representing the timestamp of when the occurrence happened.
Describes the subject of the event in the context of the event producer.
Content type of
data value. If omitted, it implies the data is a JSON value conforming to the “application/json” media type.An URI formatted string, or runtime expression, that identifies the schema that
data adheres to.The event payload.
Additional properties can be supplied, see the Cloud Events specification documentation for more info.When used in an event filter, at least one property must be supplied.
Event Consumption Strategy
Represents the configuration of an event consumption strategy.Configures the workflow to wait for all defined events before resuming execution.Required if
any and one have not been set.Configures the workflow to wait for any of the defined events before resuming execution.Required if
all and one have not been set.If empty, listens to all incoming events.Configures the workflow to wait for the defined event before resuming execution.Required if
all and any have not been set.Configures the runtime expression condition or the events that must be consumed to stop listening.Only applies if
any has been set, otherwise ignored.If not present, once any event is received, it proceeds to the next task.Correlation
A correlation is a link between events and data, established by mapping event attributes to specific data attributes, allowing for coordinated processing or handling based on event characteristics.A runtime expression used to extract the correlation value from the filtered event.
A constant or a runtime expression, if any, used to determine whether or not the extracted correlation value matches expectations.If not set, the first extracted value will be used as the correlation’s expectation.
Examples
Listen for a Single Event
Listen for Any of Multiple Events
Listen for All Events
Event Filtering with Data Conditions
Event Correlation
Listen Until Condition
Listen with For Each Processing
Read Event Envelope
read property specifies how events are read during the listen operation:
data: Reads the event’s data (default)envelope: Reads the event’s envelope, including its context attributesraw: Reads the event’s raw data
Emitting Events
You can emit events using theemit task:
Emit with Dynamic Properties
Event Consumption in Workflows
A
listen task produces a sequentially ordered array of all the events it has consumed, and potentially transformed using foreach.output.as.