Event Implementation Standard¶
Purpose¶
The Event Implementation Standard defines how the backend should implement internal event coordination while preserving Spring Boot Modulith boundaries.
Event Types¶
| Type | Standard |
|---|---|
| Domain event | Produced by owning domain behavior. |
| Application event | Produced by use-case coordination. |
| Integration event | Produced at an external boundary. |
| Outbox event | Persisted event record for reliable publication. |
Rules¶
- Event names are past tense.
- Source modules publish their own events.
- Consumers are idempotent.
- Events include tenant, organization, actor, correlation, causation, source, and version metadata where applicable.
- Outbox is used for events requiring reliable delivery.
- Consumers must not mutate publisher-owned facts.
- Event handlers must be small and route behavior to owning application services.
Event Flow¶
sequenceDiagram
participant App as Application Service
participant Domain
participant Outbox
participant EventBus as Internal Event Bus
participant Consumer
App->>Domain: Execute behavior
Domain-->>App: Event fact
App->>Outbox: Persist when reliable delivery required
App->>EventBus: Publish internally
EventBus->>Consumer: Deliver event
Consumer->>Consumer: Process idempotently
Testing Expectations¶
Event tests verify publication, metadata, outbox persistence where required, idempotent consumption, and no source-ownership violations.