Skip to content

Event Bus Specification

Document ID: WF-010 Version: 1.0.0 Status: Draft Owner: Workflow Engine Team Last Updated: 2026-06-26


This document defines the Event Bus architecture for the Wovyr Workflow Engine.

The Event Bus is responsible for delivering immutable events between internal engine components and external systems.

It enables:

  • Event-driven workflows
  • Loose coupling
  • Distributed execution
  • Durable messaging
  • Workflow replay
  • Event sourcing
  • External integrations
  • Real-time notifications
  • Agent communication

The Event Bus is one of the core infrastructure components of the workflow platform.


The Event Bus must provide:

  • Durable delivery
  • At-least-once delivery
  • Ordered delivery within a stream
  • Horizontal scalability
  • Multi-tenant isolation
  • Replay capability
  • Backpressure handling
  • High throughput

  1. Events are immutable.
  2. Events are append-only.
  3. Every event has a globally unique identifier.
  4. Event payloads are versioned.
  5. Consumers are independent.
  6. Event processing is idempotent.
  7. Event ordering is preserved within a workflow.
  8. Events are replayable.

Workflow Runtime
┌───────────────┼────────────────┐
▼ ▼ ▼
Scheduler State Machine Retry Engine
│ │ │
└───────────────┼────────────────┘
Event Publisher
Event Bus Core
┌─────────────────┼──────────────────┐
▼ ▼ ▼
Event Store Internal Topics External Topics
│ │ │
▼ ▼ ▼
Replay Engine Subscribers Webhooks/Kafka/NATS

Event Created
Validated
Persisted
Published
Consumed
Acknowledged

Events are persisted before publication.


eventId:
eventType:
eventVersion:
workflowId:
executionId:
tenantId:
correlationId:
causationId:
timestamp:
producer:
payload:
metadata:

  • WorkflowCreated
  • WorkflowValidated
  • WorkflowStarted
  • WorkflowPaused
  • WorkflowResumed
  • WorkflowCompleted
  • WorkflowCancelled
  • WorkflowFailed

  • ActivityScheduled
  • ActivityStarted
  • ActivityCompleted
  • ActivityFailed
  • ActivityRetried
  • ActivityTimedOut

  • LeaseGranted
  • LeaseExpired
  • WorkerRegistered
  • WorkerDisconnected

  • RetryScheduled
  • RetryStarted
  • RetryCompleted
  • RetryExhausted

  • CompensationStarted
  • CompensationCompleted
  • CompensationFailed

  • CheckpointCreated
  • SnapshotRestored
  • RecoveryStarted
  • RecoveryCompleted

CategoryDescription
DomainBusiness events
WorkflowEngine lifecycle
SystemInfrastructure
AuditSecurity and compliance
MetricsOperational telemetry

Each workflow execution owns an independent event stream.

Workflow A
1
2
3
4
5
Workflow B
1
2
3
4

Ordering is guaranteed within a stream but not across different workflows.


Events are stored in an append-only log.

Properties:

  • Immutable
  • Sequential
  • Durable
  • Versioned
  • Replayable

Ordering guarantees:

  • Workflow-local ordering
  • Activity-local ordering
  • Checkpoint ordering
  • Compensation ordering

Global ordering is not required.


Delivery guarantees:

  • At least once
  • Ordered per stream
  • Durable
  • Retryable

Consumers must implement idempotency.


pub trait EventPublisher {
fn publish(
&self,
event: WorkflowEvent,
) -> Result<EventId>;
}

pub trait EventSubscriber {
fn handle(
&self,
event: WorkflowEvent,
) -> Result<()>;
}

Replay reconstructs runtime state.

Process:

Load Stream
Read Events
Apply Events
Rebuild State

Replay is deterministic.


Each event contains:

eventVersion:
schemaVersion:
producerVersion:

Older versions remain readable.


Example:

workflow.created
workflow.completed
workflow.failed
activity.started
activity.completed
activity.failed
scheduler.worker.registered
scheduler.lease.expired
system.checkpoint.created
audit.security

Consumers may subscribe by:

  • Workflow
  • Tenant
  • Event Type
  • Topic
  • Labels
  • Tags

Filtering occurs before delivery.


Undeliverable events are moved to the DLQ.

Stored information:

  • Event
  • Consumer
  • Failure reason
  • Retry count
  • Timestamp

Operators may replay events manually.


Supported transports:

  • Kafka
  • NATS
  • RabbitMQ
  • Redis Streams
  • Apache Pulsar
  • AWS SNS
  • AWS SQS
  • Azure Service Bus
  • Google Pub/Sub
  • Webhooks

Transport implementations are pluggable.


The Event Bus enforces:

  • Authentication
  • Authorization
  • TLS
  • Tenant isolation
  • Payload encryption
  • Audit logging

Sensitive payloads may be encrypted.


Metrics:

  • Published events
  • Consumed events
  • Processing latency
  • Queue depth
  • Failed deliveries
  • Replay count
  • DLQ size

Every published event logs:

eventId:
workflowId:
executionId:
tenantId:
eventType:
producer:
timestamp:

MetricTarget
Publish latency< 5 ms
Delivery latency< 20 ms
Replay throughput100K events/sec
Ordering correctness100%
Delivery durability100%

engine-workflow/
└── eventbus/
├── bus.rs
├── publisher.rs
├── subscriber.rs
├── stream.rs
├── event.rs
├── serializer.rs
├── replay.rs
├── router.rs
├── dlq.rs
├── metrics.rs
└── mod.rs

  • Event serialization
  • Routing
  • Filtering
  • Ordering
  • Replay
  • Multi-worker delivery
  • Scheduler integration
  • Retry integration
  • Million-event streams
  • Concurrent publishers
  • Large payloads
  • High-throughput replay
  • Broker failure
  • Duplicate delivery
  • Consumer crash
  • Network partition

RequirementTarget
Event durability100%
Ordering accuracy100%
Duplicate handlingIdempotent
Replay correctness100%
Horizontal scalabilityUnlimited through partitioning

  • Workflow Overview
  • Execution Model
  • Scheduler
  • State Machine
  • Checkpointing
  • Retry Engine
  • Compensation Engine
  • Persistence
  • Distributed Execution
  • Agent Runtime
  • Rust Crate Design

  • Event compression
  • Cross-region replication
  • Event snapshots
  • GraphQL subscriptions
  • Event schema registry
  • Event transformation pipelines
  • AI event analytics

VersionDateDescription
1.0.02026-06-26Initial Event Bus Specification