Event Types and Naming Conventions
What you'll learn: How to organize events into clear categories and name them consistently to keep your event-driven architecture maintainable.
Why Event Classification Matters
In an event-driven system, you'll generate dozens or hundreds of different event types. Without structure, chaos follows. Think of it like organizing a library: without categories and a clear naming system, finding the right book becomes impossible.
The Three Event Categories
Domain Events represent meaningful business occurrences in your application. They capture what happened from a user or business perspective:
OrderPlaced,UserRegistered,PaymentCompleted- These are the events your business stakeholders care about
System Events track infrastructure and operational activities:
FunctionExecutionFailed,QueueDepthExceeded,CacheInvalidated- These help you monitor health and performance
Integration Events flow between different systems or bounded contexts:
InventoryUpdatedFromWarehouse,CustomerSyncedToMarketing- These coordinate separate services or external systems
Naming Conventions
Use consistent patterns to make events self-documenting:
Past tense verbs: Events describe something that already happened
- Good:
OrderShipped,AccountCreated - Avoid:
ShipOrder,CreateAccount
Namespace prefixing: Group related events
order.placed,order.cancelled,order.shippeduser.registered,user.updated,user.deleted
Version indicators: Plan for evolution
order.placed.v1,order.placed.v2- Or use separate fields:
{"eventType": "order.placed", "version": 2}
Key Takeaway: Categorizing events as domain, system, or integration types and following consistent naming patterns (past tense, namespaced, versioned) creates a maintainable event-driven architecture that scales with your organization.