Example – event sourced join

In this example, we leverage Event Sourcing and ACID 2.0 to create views that join and group data from multiple event types emitted by multiple components. These events can arrive out of order and the logic is idempotent. In this example, we want to asynchronously join the user-created, user-loggedIn, and order-submitted event types and produce a view which aggregates the user ID, username, last logged in timestamp, and the count of recent orders.

This approach leverages two tables: a view table and an event store table. The view table is the same as the one in the preceding inverse optimistic lock example, so it is excluded for brevity. The following is a fragment from the serverless.yml file, which defines the ...

Get Cloud Native Development Patterns and Best Practices now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.