What is it?

Explaining first what it is not should help.

Most programmers start out building simple programs/websites/apps with a straight forward request/response flow.

Something like this, probably with a bit more layers:

sequenceDiagram
 actor User
 participant Cart
 participant Database
 
 
 User->>Cart: Put in cart
 Cart->>Database: Save in table
 Database-->>Cart: List of items in cart + 1
 Cart-->>User: Page + list of items in cart

Very straightforward, and in this flow the user waits in some form for the response to come back.

… to be continued…

What patterns are often used when applying an event-driven architecture?

Always publish an event as a result of a process

This is a good practice because, it

  • lowers the friction when building new functionality
  • allows for testing from a more behaviour driven approach to testing.
    • You can test from the outside in and don’t couple tests to implementation as easily.
    • Related pattern Decider pattern.

Saga pattern

This paragraph seems to align with Event-Carried State Transfer, see below.

Event Notification vs Event-Carried State Transfer

When do we prefer one over the other?

Related:

Source(s):