Event models in Confluence
An event model tells the story of a system as a timeline of screens, commands, events and read models.
Last updated
When to use it
Use an event model to design or explain an event-driven feature from the user’s point of view: what the user sees, which command they send, which event is stored and which view is updated. It is read from left to right, like a storyboard.
Example
This is the code of the Order events template: an event-modeled checkout from order placement to invoice.
eventmodeling
tf 01 ui CheckoutPage
tf 02 cmd PlaceOrder
tf 03 evt OrderPlaced [[OrderPlaced]]
tf 04 rmo OrderStatus
rf 05 evt Payments.PaymentCaptured
tf 06 pcr InvoiceProcessor
tf 07 cmd GenerateInvoice
tf 08 evt InvoiceSent
tf 09 rmo OrderStatus ->> 03 ->> 08
data OrderPlaced {
orderId: string
total: number
}
Vellnar Diagrams draws it like this:
Change a line and the diagram changes with it. Nobody needs the original drawing file, because there is none: the code is the diagram.
Add it to a Confluence page
- Edit a Confluence page and type
/mermaidwhere the diagram should go. - Select Mermaid diagram. The editor opens with the template list.
- Pick a template, or choose Start blank and paste the code above. The preview follows every keystroke.
- Choose Save. The diagram appears on the page.
The documentation covers the editor, the settings and the exports.
Templates
The Templates button in the editor has one event model ready to use:
- Order events: An event-modeled checkout from order placement to invoice.
Syntax
The code of a event model starts with eventmodeling. The Mermaid documentation describes every element of the syntax. Vellnar Diagrams draws it with Mermaid 12.3; if a line has an error, the editor marks the line and keeps the last valid diagram on screen.
More
- Mermaid in Confluence: how diagrams as code work in a page, and every diagram type.
- Security: the app asks for no permissions and sends nothing outside Atlassian.