Skip to content

Connect Services

Declare a Relationship, the edge from a consumer Element to the provider it depends on, so the viewer and agents know what depends on what.

  • The consumer is in the Model. See Add a Service.
  • The provider is in the Model, in your Project or another. See Relationships for which way a Relationship points.

1. Declare the Relationship under the consumer

Section titled “1. Declare the Relationship under the consumer”

Add a relationships entry under the consumer, with to naming the provider. Name a provider in another Project by its Qualified id, project:id, as core:mainframe here:

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”. The other fields are in the Relationship reference.

Skip this step for a call. For an event, declare the Relationship under the Subscriber, pointing to the Publisher. Add interaction: async, the broker Service as via, and the topic as channel:

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
Terminal window
archidocs check
0 errors, 0 warnings

Run archidocs dev and select the consumer. The Element panel lists the new Relationship, and the Views that show both ends draw it.

check refuses via and channel on a Relationship without interaction: async:

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
archidocs/shop/model.yaml:12:9 error via-on-sync `via` is only for an async Relationship; add `interaction: async` or remove `via`
archidocs/shop/model.yaml:13:9 error via-on-sync `channel` is only for an async Relationship; add `interaction: async` or remove `channel`
2 errors, 0 warnings
Rule docs:
via-on-sync https://archidocs.dev/docs/reference/rules/via-on-sync/

That is via-on-sync: add interaction: async.

check reports unknown-element when to names an id that isn’t in the Model. Correct the id, or write the Qualified id of a provider in another Project. If the provider isn’t in the Model yet, leave the Relationship out and tell the provider’s Team.

check reports via-not-broker when via names a Service that isn’t type: broker.

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

Documents the beta branch at cd98671, ahead of the latest release, v1.4.0.