8. Canonical models for integration
When many systems exchange the same thing, agree one message for it. Each system then maps to that message once, instead of to every other system, and a change in one system stays in its own mappings.
The clip shows six of Harbour Mutual's systems that exchange policies. Wired point to point, each maps to and from every other: thirty mappings. Beside them, the same six exchange one canonical Policy message: each maps once in and once out, twelve mappings. Then billing renames a field (ten mappings change point to point, two through the canonical model), a new field is added in one place and carried through every mapping, and Kestrel's policy system joins (twelve new mappings point to point, two through the canonical model).
The idea: agree the message, not every pair
Every system names things its own way: the policy system's POL_NO is billing's contract_no and the broker portal's policyRef. When two systems exchange policies, someone writes a mapping from one set of names and formats to the other. With six systems all talking to each other, that is a mapping for every pair, each way: six times five, thirty mappings to build, test and keep in step.
A canonical model is one agreed shape for the thing being exchanged: here a Policy message with seven fields, each with one name, one type and one meaning. Each system maps its own record to the canonical message and back, and nothing else. Six systems need twelve mappings; a seventh adds two, not twelve.
POL_NO; only the message says policy_number.A worked example: one Policy message for six systems
Harbour Mutual's canonical Policy message has 7 fields. The table shows four of the six systems: each fills the fields it has, under its own names, and converts on the way where it must (billing keeps premiums in cents; the policy system writes dates as eight digits).
| Canonical field | Policy administration | Broker portal | Billing | Data warehouse |
|---|---|---|---|---|
policy_number | POL_NO | policyRef | contract_no | policy_number |
holder_party_id | CUST_NO | clientId | debtor_id | customer_key |
product_code | PROD_CD | productName | – | product_key |
start_date | EFF_DT | inceptionDate | – | start_date |
end_date | EXP_DT | – | – | end_date |
status | POL_STAT | – | – | status |
annual_premium_eur | ANN_PREM | premium | premium_annual_cents | annual_premium |
With the canonical message in place, billing's rename of contract_no changes billing's own two mappings and nothing else, where point to point it changed 10. And when Kestrel's policy system joins, it needs 2 new mappings, not 12.
Why it matters for Alex
The merger will connect Kestrel's six systems to Harbour Mutual's twelve, and then replace Kestrel's one by one. Point to point, every replacement means rewriting the mappings of every system it talked to. With a canonical model, Alex can promise the programme that each replacement touches its own two mappings, and can say what "policy" means on the wire before anyone builds an interface.
It also tells Alex where to spend design time: on the few messages many systems exchange (policy, party, claim), not on a model of everything.
Where it goes wrong
- The canonical model of everything. Trying to agree every attribute of every entity before the first message flows takes years. Start with the fields the exchanges need, and add more when someone needs them.
- The lowest common denominator. A message so generic (a list of name and value pairs) that every system interprets it differently is a canonical model in name only.
- Nobody owns it. A canonical message without an owner and a version number drifts as each team adds what it needs (chapter 24's contracts fix this).
- A canonical model for two systems. One temporary feed between two systems does not need one; the extra layer only costs time.
Exercises
The lab checks each one against facts written down in advance, so any answer the brief allows passes. A pass is kept in this browser.
Map Kestrel's policies to the canonical message
Kestrel's policy table has the columns below. For each one, choose the canonical field it fills, or leave it in Kestrel's system if the message does not need it. Nothing may be lost, and nothing invented.
polis_nr
klant_nr
product_code
ingangsdatum
einddatum
status
jaarpremie
polis_id
Count the mappings
For each situation, choose how many mappings it needs or changes. Count each direction as a mapping of its own.
Choose how systems exchange policies
How should the systems in the brief exchange their data: point to point, through a canonical model, or through one shared database? Pass all 3 situations to complete it.
Until Kestrel's claims move to Harbour Mutual's claims system next spring, Kestrel's new claims must reach it every night. Nothing else will use the feed, and it will be switched off after the migration.
On Azure
Azure has no service called a canonical model: it is a design you carry out with the integration services.
- The message: publish the canonical Policy message's schema where every team finds it, with an owner and a version (chapter 24), for example as an API in Azure API Management.
- The transport: Azure Service Bus topics or Azure Event Grid carry canonical messages from one publisher to many subscribers, so a new system subscribes instead of being wired to each sender.
- The mappings: each system's adapter, an Azure Logic Apps workflow, an Azure Function or an Azure Data Factory pipeline, maps the system's own fields to the canonical message and back.
- In the lakehouse: the silver layer often plays the canonical role for analytics: each source is conformed once to shared tables, instead of each report joining every source its own way (chapter 26).
Take it to work
Canonical message design
Design one canonical message that several systems exchange.
The exchange
- What is exchanged, and between which systems?
- How many mappings does it need today, point to point?
The fields
- Each field: name, type, meaning
- Which systems fill it, and with what conversion?
What stays behind
- Which source fields does no consumer need?
Ownership
- Who owns the message, and how is a new version agreed?
Tools in this chapter
- Information map · The enterprise information map: capabilities, domains, systems, flows and platforms, each layer switched on or off.
Terms taught here: Canonical data model