Skip to content

Connect Services

A Relationship says that a consumer depends on a provider. See Relationships for why they point the way they do.

Under the consumer, add a relationships entry pointing to the provider:

payments/model.yaml
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 8583
  • Write the description as a verb phrase that completes “consumer … provider”: “Stores payment state in”.
  • Put the protocol or format in technology: “JDBC”, “JSON/HTTPS”, “gRPC”.
  • Declare it at the most detailed level you know: between Components if the code shows which part calls which, else between Services. Edges between Systems are derived from these.

Name a provider in another Project by its Qualified id, project:id, as core:mainframe above. Declare only your Project’s outbound Relationships: the provider’s Team declares its own. If the provider isn’t in the Model yet, leave the Relationship out and tell its Team; don’t declare another Team’s Elements in your Project.

A provider outside the organisation, such as a payment provider’s API, can be declared in your Project as an External Service.

An event is declared by the Subscriber, pointing to the Publisher whose events it depends on, with interaction: async, via the broker Service and channel the topic or queue:

payments/model.yaml
fraud-detection:
name: Fraud Detection
description: Scores each payment for fraud and holds suspicious ones.
technology: Python
relationships:
- to: payments-service
description: Scores each initiated payment
interaction: async
via: platform:kafka
channel: payments.initiated

The broker must be a Service with type: broker (via-not-broker). Leave out interaction: async and check refuses via and channel:

shop/model.yaml · fails check: via-on-sync
services:
orders:
name: Orders
events:
name: Events
type: broker
mailer:
name: Mailer
relationships:
- to: orders
description: Emails a receipt for each placed order
via: events
channel: orders.placed

That is via-on-sync: add interaction: async to the Relationship. An async Relationship with no broker, such as a webhook, has interaction: async and no via.

Terminal window
archidocs check

Then look at it in the viewer: archidocs dev, select the consumer, and its new Relationship is listed in the Element panel and drawn on the Views that show both ends.

upsert_relationship adds or updates one, and search_elements resolves a provider’s name, URL or host to its Qualified id.