What are Domain Events?
Domain Events represent something significant that happened in your domain. They enable loose coupling between aggregates and support event-driven architectures. The Rich Domain core library provides interfaces only - you implement the event publishing mechanism according to your needs (in-memory, message queues, event streams, etc.).Creating Events
Basic Event
Events are created by extendingDomainEvent with a typed payload:
Event with Queue Name (Optional)
You can specify a staticqueueName for routing events to specific queues (useful for message queue implementations):
Event Properties
Every domain event automatically has these properties:Raising Events from Aggregates
UseaddDomainEvent() inside aggregate methods to record events:
Event Bus Interface
Rich Domain provides theIDomainEventBus interface with two methods: