Events

Events are messages that communicate that something has happened in the business domain or application. They represent facts about the past that cannot be changed. Other parts of the application, or even other applications, can react to these events.

Core concepts

The list below quickly mentions the core concepts that come into play when thinking about events. For more detail, be sure to read the other sections within this chapter.

Events: Messages that represent facts about something relevant that has happened in an application.

Event Handlers

Methods or lambdas that react to events and execute business logic or update read models.

Event Handling Components

Classes containing one or more event handlers, registered with an event processor for event delivery.

Event Processors

Infrastructure components that manage the delivery of events to event handling components, controlling threading, batching, and error handling.

Event Sink

An abstraction for any component that can receive and distribute events, encompassing the Event Bus, Event Store, and external system facades.

Event Appender

A context-aware solution to append events to an Event Store, ensuring transactionality and correlation data.

Event Bus

A mechanism that distributes published events to all subscribed event processors within the application.

Event Gateway

A convenience component for publishing events that provides a user-friendly API.

Event Store

A persistent storage mechanism that stores events as the source of truth and provides event streams to processors.

Event Sourcing

An architectural pattern that stores all changes to application state as a sequence of immutable events, providing a complete audit trail and enabling temporal queries.

Dynamic Consistency Boundaries (DCB)

A pattern that allows flexible grouping of events using tags to define consistency boundaries based on business needs rather than technical constraints.

Event handling overview

This section covers the complete event handling capabilities:

Sub-Section Purpose

Publishing

Publishing events using EventSink, EventAppender, and EventGateway

Handling

Implementing event handlers with @EventHandler annotation

Event Processors

Configuring and managing event processors (pooled streaming and subscribing)

Infrastructure

EventStore, Dynamic Consistency Boundaries, tags, and event storage

Versioning

Evolving event structures with payload conversion and upcasters