xFlow
  • Overview
    • Introduction
    • Core Features
    • Architecture
      • High Level Architecture
      • Tech Stack
      • Deployment Flexibility
      • Performance and Scalability
      • Security Compliance
  • Getting Started
    • Installation
    • Quick Start
    • Configuration
  • Core Concepts
    • Serverless Workflow Specification
    • Workflow data handling
    • Workflow Expressions
    • Error handling
    • Input and Output schema definition
    • User Task
    • User Forms
      • Lowcode Form
      • Advanced User Form
    • AI Agents in Enterprise Business Processes
    • Comparisons
      • BPMN2
  • Developer Guide
    • Architecture
    • API Reference
    • Workflow States Reference
      • Event State
      • Operation State
      • Switch State
      • Parallel State
      • Inject State
      • ForEach State
      • Callback State
      • UserTask State
      • AIAgent State
      • AIAgentProxy State
      • UserProxyAgent State
      • AI Outbound Agent State
    • Workflow Functions
      • REST
      • GraphQL
      • Custom
        • Built-in Functions
        • Lowcoder Query Function
      • Function Auth
    • Workflow Secrets
    • Integrations
    • Workflow Modeler
    • Frontend Development
      • Forms
        • Lowcode Form
        • Advanced User Form
    • Serverless Workflow Development
      • Operation State
      • Switch State
      • Parallel State
      • ForEach State
      • Callback State
      • User Task State
    • AI Agent Development
      • AI Agent
        • Predefined LLM
        • LLM Configuration
        • Multi LLM Configuration
        • Chat Memory
        • Tools
        • Data Output
        • Agent Outcomes
      • AI Agent Proxy
        • AI Agents Integration
      • User Proxy Agent
      • xChatBot Integration
  • Examples
    • Basic Examples
    • Advanced Examples
      • Loan Approval Workflow
      • QMS AP Workflow
  • Administration
    • Monitoring and Logging
    • Security
    • Performance Tuning
  • Extensions and Customizations
    • Plugins and Add-ons
  • Troubleshooting
    • Common Issues
    • FAQs
  • Release Notes
    • Version History
    • Upcoming Features
  • Support
    • Contact Information
    • Community
Powered by GitBook
On this page
  1. Developer Guide
  2. Workflow States Reference

Event State

Parameter
Description
Type
Required

name

Unique State name

string

yes

type

State type

string

yes

exclusive

If true, consuming one of the defined events causes its associated actions to be performed. If false, all of the defined events must be consumed in order for actions to be performed. Default is true

boolean

no

onEvents

Define the events to be consumed and optional actions to be performed

array

yes

timeouts

State specific timeout settings

object

no

stateDataFilter

State data filter definition

object

no

transition

Next transition of the workflow after all the actions have been performed

string or object

yes (if end is not defined)

onErrors

States error handling definitions

array

no

end

Is this state an end state

boolean or object

yes (if transition is not defined)

compensatedBy

Unique name of a workflow state which is responsible for compensation of this state

string

no

metadata

Metadata information

object

no

Example:

JSON
YAML

Event states await one or more events and perform actions when they are received. If defined as the workflow starting state, the event state definition controls when the workflow instances should be created.

The exclusive property determines if the state should wait for any of the defined events in the onEvents array, or if all defined events must be present for their associated actions to be performed.

Following two figures illustrate the exclusive property:

If the Event state in this case is a workflow starting state, the occurrence of any of the defined events would start a new workflow instance.

If the Event state in this case is a workflow starting state, the occurrence of all defined events would start a new workflow instance.

In order to consider only events that are related to each other, we need to set the correlation property in the workflow events definitions. This allows us to set up event correlation rules against the events extension context attributes.

If the Event state is not a workflow starting state, the timeout property can be used to define the time duration from the invocation of the event state. If the defined event, or events have not been received during this time, the state should transition to the next state or can end the workflow execution (if it is an end state).

The timeouts property can be used to define state specific timeout settings. Event states can define the stateExecTimeout, actionExecTimeout, and eventTimeout properties. For more information about Event state specific event timeout settings reference this section. For more information about workflow timeouts reference the Workflow Timeouts section.

Note that transition and end properties are mutually exclusive, meaning that you cannot define both of them at the same time.

PreviousWorkflow States ReferenceNextOperation State

Last updated 1 year ago

{
"name": "monitor-vitals",
"type": "event",
"exclusive": true,
"onEvents": [{
        "eventRefs": ["high-body-temperature"],
        "actions": [{
            "functionRef": {
                "refName": "send-tylenol-order",
                "arguments": {
                    "patientid": "${ .patientId }"
                }
            }
        }]
    },
    {
        "eventRefs": ["high-blood-pressure"],
        "actions": [{
            "functionRef": {
                "refName": "call-nurse",
                "arguments": {
                    "patientid": "${ .patientId }"
                }
            }
        }]
    },
    {
        "eventRefs": ["high-respiration-rate"],
        "actions": [{
            "functionRef": {
                "refName": "call-pulmonologist",
                "arguments": {
                    "patientid": "${ .patientId }"
                }
            }
        }]
    }
],
"end": {
    "terminate": true
}
}
name: monitor-vitals
type: event
exclusive: true
onEvents:
- eventRefs:
  - high-body-temperature
  actions:
  - functionRef:
      refName: send-tylenol-order
      arguments:
        patientid: "${ .patientId }"
- eventRefs:
  - high-blood-pressure
  actions:
  - functionRef:
      refName: call-nurse
      arguments:
        patientid: "${ .patientId }"
- eventRefs:
  - high-respiration-rate
  actions:
  - functionRef:
      refName: call-pulmonologist
      arguments:
        patientid: "${ .patientId }"
end:
  terminate: true