Activity Events
Activities are individual units of work within a workflow. Durable Workflow dispatches events when activities start, complete, or fail, allowing you to monitor and react to activity execution.ActivityStarted
Dispatched when an activity begins execution within a workflow.Properties
| Property | Type | Description |
|---|---|---|
workflowId | int|string | Unique identifier for the parent workflow instance |
activityId | string | Unique identifier for this activity execution |
class | string | Fully qualified class name of the activity |
index | int | Sequential index of this activity in the workflow |
arguments | string | Serialized activity input arguments |
timestamp | string | ISO 8601 timestamp when the activity started |
Example Usage
Listening in EventServiceProvider
ActivityCompleted
Dispatched when an activity successfully completes execution.Properties
| Property | Type | Description |
|---|---|---|
workflowId | int|string | Unique identifier for the parent workflow instance |
activityId | string | Unique identifier for this activity execution |
output | string | Serialized activity output/result |
timestamp | string | ISO 8601 timestamp when the activity completed |
class | string | Fully qualified class name of the activity |
index | int | Sequential index of this activity in the workflow |
Example Usage
Listening in EventServiceProvider
ActivityFailed
Dispatched when an activity fails due to an exception or error.Properties
| Property | Type | Description |
|---|---|---|
workflowId | int|string | Unique identifier for the parent workflow instance |
activityId | string | Unique identifier for this activity execution |
output | string | Serialized error information or exception details |
timestamp | string | ISO 8601 timestamp when the activity failed |
class | string | Fully qualified class name of the activity |
index | int | Sequential index of this activity in the workflow |
Example Usage
Listening in EventServiceProvider
Activity Lifecycle Tracking
You can track the complete lifecycle of an activity by listening to all three events:EventServiceProvider: