Skip to content

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.

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.

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.

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.

SYSTEM COMMANDS AND VIEWS EVENTS invokes EVENT ReplenishmentRequested AUTOMATION AutoReplenish COMMAND CreateReplenishmentPurchaseOrder EVENT SkuReplenishmentStarted READ MODEL · TO-DO LIST ReplenishmentQueue ACM-1000 ordered ACM-2000 requested
Acme Purchasing's replenishment. ReplenishmentQueue is the to-do list: a request that still says requested has not been handled yet.

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.

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.

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.

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.

  • 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.

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.

ACME SALES ACME WAREHOUSE EVENT OrderConfirmationIssued TRANSLATION PublishOrderConfirmed PUBLIC EVENT OrderConfirmed TRANSLATION RequestReservationFromSales EVENT ReservationRequested
Acme Sales tells Acme Warehouse that an order is confirmed through a public event. Each side translates it into its own words.