EDA Core Components
Learn about the core components of the event patterns: event, queue, producer, and consumer.
We'll cover the following...
Observe that four components are found at the center of all event patterns, as illustrated in the following diagram:
Event
At the heart of EDA is the event. In EDA terms, it is an occurrence that has happened in the application. The event itself is in the past and is an immutable fact. Some examples of events are customers signing up for our services, payments being received for orders, or failed authentication attempts for an account.
With EDA, the consumers of these events may know nothing about what caused the production of these events or have any relationship or connection with them, but only with the event itself.
Example
In most languages, events are simple value objects that contain a state. An event is equal to another if all the attributes are the same. In Go, we would represent an event with a simple struct
, such as this one for PaymentReceived
:
type PaymentReceived struct {PaymentID stringOrderID stringAmount int}