Event Modeling
Explore how to design event-driven models for GraphQL subscriptions in Elixir with Absinthe. Learn to track an order's lifecycle and instantly update subscribers with real-time changes, using PostgreSQL JSON snapshots to handle historical order data accurately. Understand building and testing order creation with Phoenix context generators.
We'll cover the following...
Introduction to modeling
Subscriptions push data in response to events or actions within our system, so it isn’t enough to think of subscriptions as a purely API-related concern. A system that can’t model change will have a tough time communicating about changes to subscribers. When we design our application, we want to arrive at a model that lets us track the life cycle of an order as it is started, completed, and ultimately picked up by the customer. Along the way, each of these changes should be transmitted immediately to employees tasked with making the order, and to the hungry customer waiting for their food.
This part of the system is a bit more involved than the menu, so let’s take it in pieces. The first piece focuses on creating the ...