Events Bus schema — Kernel Protocol reference Events Bus schemas of the ObjectStack Kernel Protocol: EventBusConfig — each property with its type, default and a TypeScript example.
Source: packages/spec/src/kernel/events/bus.zod.ts
import { EventBusConfigSchema } from '@objectstack/spec/kernel' ;
import type { EventBusConfig } from '@objectstack/spec/kernel' ;
// Validate data
const result = EventBusConfigSchema. parse (data);
Property Type Required Description persistence { enabled?: boolean; retentionDays: integer; filter?: any; storage?: Enum<'database' | 'file' | 's3' | 'custom'> }optional Event persistence configuration queue { name?: string; concurrency?: integer; retryPolicy?: object; deadLetterQueue?: string; … }optional Event queue configuration eventSourcing { enabled?: boolean; snapshotInterval?: integer; snapshotRetention?: integer; retentionDays?: integer; … }optional Event sourcing configuration replay { enabled?: boolean }optional Event replay configuration webhooks { id?: string; eventPattern: string; url: string; method?: Enum<'GET' | 'POST' | 'PUT' | 'PATCH'>; … }[]optional Webhook configurations messageQueue { provider: Enum<'kafka' | 'rabbitmq' | 'aws-sqs' | 'redis-pubsub' | 'google-pubsub' | 'azure-service-bus'>; topic: string; eventPattern?: string; partitionKey?: string; … }optional Message queue integration realtime { enabled?: boolean; protocol?: Enum<'websocket' | 'sse' | 'long-polling'>; eventPattern?: string; userFilter?: boolean; … }optional Real-time notification configuration eventTypes { name: string; version?: string; schema?: any; description?: string; … }[]optional Event type definitions handlers { id?: string; eventName: string; handler: any; priority?: integer; … }[]optional Global event handlers
Property Type Required Description enabled booleanoptional (default: false) Enable event persistence retentionDays integer✅ Days to retain persisted events retention neveroptional [REMOVED] EventPersistence.retention was renamed to retentionDays in @objectstack/spec 17 — the unit of a duration-shaped number lives in the key name, not only in the describe prose. Rename the key to retentionDays; the value (days) is unchanged. filter anyoptional Optional filter function to select which events to persist storage Enum<'database' | 'file' | 's3' | 'custom'>optional (default: "database") Storage backend for persisted events
Property Type Required Description name stringoptional (default: "events") Event queue name concurrency integeroptional (default: 10) Max concurrent event handlers retryPolicy { maxRetries?: integer; backoffStrategy?: Enum<'fixed' | 'linear' | 'exponential'>; initialDelayMs?: integer; maxDelayMs?: integer }optional Default retry policy for events deadLetterQueue stringoptional Dead letter queue name for failed events priorityEnabled booleanoptional (default: true) Process events based on priority
Property Type Required Description enabled booleanoptional (default: false) Enable event sourcing snapshotInterval integeroptional (default: 100) Create snapshot every N events snapshotRetention integeroptional (default: 10) Number of snapshots to retain retentionDays integeroptional (default: 365) Days to retain events retention neveroptional [REMOVED] EventSourcingConfig.retention was renamed to retentionDays in @objectstack/spec 17 — the unit of a duration-shaped number lives in the key name, not only in the describe prose. Rename the key to retentionDays; the value (days) is unchanged. The neighbouring snapshotRetention is a COUNT of snapshots, not a duration, so it keeps its name. aggregateTypes string[]optional Aggregate types to enable event sourcing for storage { type?: Enum<'database' | 'file' | 's3' | 'eventstore'>; options?: Record<string, any> }optional Event store configuration
Property Type Required Description enabled booleanoptional (default: true) Enable event replay capability
Property Type Required Description id stringoptional Unique webhook identifier eventPattern string✅ Event name pattern (supports wildcards) url string✅ Webhook endpoint URL method Enum<'GET' | 'POST' | 'PUT' | 'PATCH'>optional (default: "POST") HTTP method headers Record<string, string>optional HTTP headers authentication { type: Enum<'none' | 'bearer' | 'basic' | 'api-key'>; credentials?: Record<string, string> }optional Authentication configuration retryPolicy { maxRetries?: integer; backoffStrategy?: Enum<'fixed' | 'linear' | 'exponential'>; initialDelayMs?: integer; maxDelayMs?: integer }optional Retry policy timeoutMs integeroptional (default: 30000) Request timeout in milliseconds transform anyoptional Transform event before sending enabled booleanoptional (default: true) Whether webhook is enabled
Property Type Required Description provider Enum<'kafka' | 'rabbitmq' | 'aws-sqs' | 'redis-pubsub' | 'google-pubsub' | 'azure-service-bus'>✅ Message queue provider topic string✅ Topic or queue name eventPattern stringoptional (default: "*") Event name pattern to publish (supports wildcards) partitionKey stringoptional JSON path for partition key (e.g., "metadata.tenantId") format Enum<'json' | 'avro' | 'protobuf'>optional (default: "json") Message serialization format includeMetadata booleanoptional (default: true) Include event metadata in message compression Enum<'none' | 'gzip' | 'snappy' | 'lz4'>optional (default: "none") Message compression batchSize integeroptional (default: 1) Batch size for publishing flushIntervalMs integeroptional (default: 1000) Flush interval for batching
Property Type Required Description enabled booleanoptional (default: true) Enable real-time notifications protocol Enum<'websocket' | 'sse' | 'long-polling'>optional (default: "websocket") Real-time protocol eventPattern stringoptional (default: "*") Event pattern to broadcast userFilter booleanoptional (default: true) Filter events by user tenantFilter booleanoptional (default: true) Filter events by tenant channels { name: string; eventPattern: string; filter?: any }[]optional Named channels for event broadcasting rateLimit { maxEventsPerSecond: integer; windowMs?: integer }optional Rate limiting configuration
Property Type Required Description name string✅ Event type name (dot notation by convention, e.g. order.created; the platform-checked event vocabulary is the closed DataEventType / BulkDataEventType enums) version stringoptional (default: "1.0.0") Event schema version schema anyoptional JSON Schema for event payload validation description stringoptional Event type description deprecated booleanoptional (default: false) Whether this event type is deprecated tags string[]optional Event type tags
Property Type Required Description id stringoptional Unique handler identifier eventName string✅ Name of event to handle (supports wildcards like user.*) handler any✅ Handler function priority integeroptional (default: 0) Execution priority (lower numbers execute first) async booleanoptional (default: true) Execute in background (true) or block (false) retry { maxRetries?: integer; backoffMs?: integer; backoffMultiplier?: number }optional Retry policy for failed handlers timeoutMs integeroptional Handler timeout in milliseconds filter anyoptional Optional filter to determine if handler should execute