Relationships
A Relationship is a directed edge from a consumer Element to the provider it depends on. It is declared once, under the consumer, with to naming the provider.
payments-service: name: Payments Service description: Validates, posts and settles customer payments. technology: Java, Spring Boot relationships: - to: payments-db description: Stores payment state in technology: JDBC - to: core:mainframe description: Posts payments to the ledger in technology: XML/HTTPS - to: card-gateway description: Settles card payments through technology: ISO 8583The description reads as a sentence from consumer to provider: “Payments Service posts payments to the ledger in Mainframe”. The technology says how: a protocol, a driver or a format. The Elements and Relationships reference lists every field.
One direction
Section titled “One direction”A Relationship always points from what depends to what is depended on. Everything upstream of an Element depends on it, directly or through others. Everything downstream is what it depends on.
A Person is only ever a consumer: it uses Systems, and nothing depends on it. archidocs check reports a Relationship to a Person as person-as-provider. An Element also can’t depend on itself, its parent or its child.
Declared once, derived above
Section titled “Declared once, derived above”Declare a Relationship at the most detailed level you know. If you know which Component calls which, declare it between those Components. If not, declare it between the Services.
Edges between higher-level Elements are derived from these, never declared. Because the Payments Service calls core:mainframe, the C2 landscape draws an edge from Payments Service to Mainframe. The C1 landscape draws one from the Payments System to the Mainframe Banking System. In the viewer, select an edge to see every Relationship it carries.
Between Projects
Section titled “Between Projects”Each Project declares only its own outbound Relationships. To name a provider in another Project, write its Qualified id, the id with its Project in front, as core:mainframe above.
Events and brokers
Section titled “Events and brokers”A Relationship is a call by default: interaction: sync, which waits for an answer. An event that goes through a message broker is async. The Subscriber, the Element that receives the events, declares it. It points to the Publisher that sends them, with via naming the broker Service and channel the topic or queue.
Impact and path questions count the broker as a hop, and as something both sides depend on. An async Relationship with no broker, such as a webhook, leaves out via.
Gateways and proxies
Section titled “Gateways and proxies”An API gateway or reverse proxy, such as Apigee, Kong or nginx, is a Service like any other. By default it sits in the path: the consumer depends on the gateway, and the gateway on the API. It is owned by the Team that runs it.
# web, in the shop Projectrelationships: - to: platform:apigee description: Places orders through technology: HTTPS
# apigee, in the platform Projectapigee: name: API Gateway technology: Apigee owner: platform-team relationships: - to: shop:api description: Routes order requests to technology: HTTPSImpact and path questions then see the hop: if the gateway is down, everything behind it is unreachable, and its Team is the one to tell.
When the gateway is shared infrastructure nobody needs to see, leave it out. The consumer points to the API directly, and the Relationship’s technology names the gateway: HTTPS via Apigee. Impact and paths skip the hop.
Either way, the gateway’s URL is the Deployment url of the API consumers reach.
Several Relationships on one pair
Section titled “Several Relationships on one pair”A consumer can depend on the same provider in two ways, such as reading over HTTPS and subscribing to events. Give each Relationship an id then, so Dynamic View Steps and agents can tell them apart.
Why it works this way
Section titled “Why it works this way”- Consumer to provider, so impact questions have an answer. Every edge points the same way, so “what breaks if the mainframe is down?” is everything upstream of it. A model that mixed directions couldn’t say.
- The consumer declares it, because the consumer knows. A Team knows what its Service calls, but rarely everything that calls it. Declaring under the consumer means each Team writes down what it depends on, in its own Project. Nobody edits another Team’s files to add a Relationship that points at them, and a Relationship belongs to its consumer’s Owner.
- The Subscriber declares an event for the same reason. The Subscriber depends on the events, so the edge points from it to the Publisher, like any other Relationship. A Publisher doesn’t need to know who listens.
- A gateway is a Service, not a new kind of thing. It runs, fails and has an owner like any Service, so modeling it as one keeps impact questions honest without a new field. Leaving it out is allowed when the hop doesn’t matter to anyone reading the Model.
- Higher-level edges are derived, so they can’t drift. Each derived edge carries every Relationship beneath it. If the C2 edge were declared separately, it could say something the Components don’t, and nothing would catch it.
Related
Section titled “Related”- Connect Services
- Elements and Relationships reference
- Views, including Dynamic Views, which walk a scenario over Relationships
Documents the beta branch at cd98671, ahead of the latest release, v1.4.0.