Portal Community

What Is the Workflow Event Bus?

The event bus is an in-process publish/subscribe mechanism scoped to the ProcessEngine. It carries two categories of events:

Built-In Lifecycle Events

Published automatically by the engine — WorkflowStarted, WorkflowCompleted, WorkflowFailed, WorkflowPaused, WorkflowResumed. You do not publish these; you subscribe to them.

Custom Domain Events

Published by your node executors — e.g., OrderApproved, DocumentProcessed. Define a class extending WorkflowEvent, inject IWorkflowEventBus, and call PublishAsync.

Event Bus vs. Node Event Subscribers

AspectIWorkflowEventBusINodeEventSubscriber
GranularityWorkflow-level (started, paused, completed)Node-level (before/after each node)
Who publishesEngine (built-ins) + node executors (custom)Engine always (automatic)
Custom eventsYes — define and publish any WorkflowEventNo — only lifecycle hooks
Subscriber interfaceIWorkflowEventHandler<TEvent>INodeEventSubscriber
Use for audit loggingWorkflow-level auditPer-node audit

Key Constraints

In-process only: The event bus lives in the ASP.NET Core process. Events do not survive a process restart. If you need durable event delivery (e.g., to trigger an external system reliably), write an event handler that pushes to a message broker (Azure Service Bus, RabbitMQ) from inside the handler.

Architecture Diagram

1

Engine publishes WorkflowStarted

ProcessEngine.StartAsync() calls IWorkflowEventBus.PublishAsync(new WorkflowStarted(...))

2

Dispatcher resolves handlers

WorkflowEventDispatcher finds all IWorkflowEventHandler<WorkflowStarted> from DI

3

Handlers execute synchronously

Each handler's HandleAsync() is awaited in registration order. Exceptions are isolated per handler.

Common Use Cases

Use CaseEvent(s) ConsumedHandler Action
Webhook deliveryWorkflowCompleted, WorkflowFailedPOST to configured webhook URL
Workflow-level auditAll built-in eventsWrite audit record to DB
Billing / usage meteringWorkflowStarted, WorkflowCompletedIncrement tenant execution counter
Dashboard live updateWorkflowStarted, WorkflowCompletedPush SignalR notification to UI
Domain notificationsCustom event: OrderApprovedSend email / Slack message