Automations and translations
Not everything in a business starts with a person pressing a button. Orders are confirmed automatically, reminders go out on a schedule, and one department reacts to what another did. An event model has two ways to describe this: automations, where the system reacts, and translations, where facts cross the border between two areas.
Automations: the system reacts
Section titled “Automations: the system reacts”An automation watches for a fact and acts on it. In Acme Commerce, when checkout completes, the shop empties the basket:
No shopper asked for that, so the automation has no screen and no person in front of it. Its row on the board belongs to the module’s System Actor, the cogwheel, which stands for the system acting on its own. Because the automation leaves a fact of its own, even unprompted work shows up in the history like everything else.
What starts an automation
Section titled “What starts an automation”Studio lets you choose the trigger:
| Trigger | Means |
|---|---|
| Event | Run when a specific fact happens. |
| Timer | Run on a fixed schedule. |
| Custom | Describe in words when it should run, and let generation use the description. |
A to-do list for the system
Section titled “A to-do list for the system”Event modelers often explain an automation as a to-do list. A read model lists what is waiting, such as orders that need a confirmation email, and the automation works through that list one item at a time. The idea helps when you are unsure whether the system has really handled something: if the item is still on the list, it has not.
When the command is refused
Section titled “When the command is refused”An automation usually carries out a command, and a command can be refused. The model can say what then happens, separately for each kind of refusal: any refusal, a failed validation, a broken constraint or a missing permission. For each, the automation can acknowledge the refusal and move on, or record an event of its own.
Translations: facts cross a border
Section titled “Translations: facts cross a border”Two areas of the business should not reach into each other’s data. The Storefront must not look in the Catalog’s tables for product information, and Sales must not look in the Storefront’s basket. They tell each other what happened instead, and each area turns what it hears into its own words. That is a translation.
Studio’s slice type for this is called Translator.
Public events: what an area promises the world
Section titled “Public events: what an area promises the world”A private event is nobody’s business outside its area. An event can be made public, which makes it a contract that the application publishes. The Acme Commerce shop’s five parts talk to each other only through such public events.
Coming in
Section titled “Coming in”When the Catalog publishes a product, the Storefront hears it and records ProductListed in its own words, with its own fields and its own meaning. The slice ListProduct does this:
On the board, you reference the outside fact, and then either add a command that carries it out or capture the outside data as facts of your own.
Going out
Section titled “Going out”The reverse happens when the shop has something to say. After checkout, the shop’s private CheckoutCompleted is turned into the public OrderPlaced, which Sales picks up:
A projection maps the private fact into the public shape, so the shop decides exactly what it reveals.
Why bother?
Section titled “Why bother?”- Each area can change independently. As long as the public event keeps its shape, the Storefront can rework its basket without Sales noticing.
- Each area keeps its own language. Sales may call it an order and the warehouse a shipment. Translations are where those words are reconciled.
- The flow stays visible. The board shows which area depends on which fact, and the application’s context map draws the same picture for whole domains.
Between modules and between applications
Section titled “Between modules and between applications”The same idea works at two sizes. Two modules on one board can be connected with a line, and a slice in one can reference an event of the other. Two applications, such as Acme Catalog and Acme Shop, talk through public events and are drawn together on the context map.
Put it to work
Section titled “Put it to work”- Add an automation or a translation on the board
- Check them with specifications
- Slices