Skip to main content
Version: Next

Model integration

Say how systems reach each other: which interface a call lands on, which channel a message travels through, and what it carries. The guide grows one small model, a shop, a step at a time, and every step is a whole model that builds with no error or lint: type it into model/ in a repository kq init made, and check it with kq validate or in VS Code as you type. Every statement used here is described in full in Integration.

Draw the calls​

A connection is written from the caller to what it calls, and always names its target: the interface it lands on, after the component's Code, and the protocol after over. The interface is created if it isn't declared: http lands on an http-api, grpc on a grpc-api, and so on for each protocol. How the caller authenticates follows, after auth. The web shop calls the order service, which calls the payment provider:

ecosystem shop "Shop" { domain selling "Selling" platform storefront "Storefront" { component web-shop "Web Shop" : user-facing-app component order-service "Order Service" : backend component payments "Payments" : saas web-shop -> order-service/orders-api over http/json auth user-token order-service -> payments/payments-api over http auth key storefront realizes selling } }

orders-api and payments-api exist because the two connections name them. a -> b with b a component is an error: say which interface. The last line says the storefront realizes Selling, as in Model the applications. See Connections.

Send messages through a broker​

A broker is messaging infrastructure, and its channels are where publishers and receivers meet. A connection over a channel says the caller publishes to it and the other end receives from it. A path through a broker is two arrows, so it states two schemes: sender-auth for the sender's, then receiver-auth for the receiver's. Add a warehouse, and a Kafka broker the order service tells it through:

ecosystem shop "Shop" { domain selling "Selling" platform storefront "Storefront" { component web-shop "Web Shop" : user-facing-app component order-service "Order Service" : backend component payments "Payments" : saas component warehouse "Warehouse" : backend broker events "Events" : kafka { channel orders "Orders" } web-shop -> order-service/orders-api over http/json auth user-token order-service -> payments/payments-api over http auth key order-service -> warehouse over events/orders sender-auth client-credentials receiver-auth client-credentials storefront realizes selling } }

The broker's kind decides what its channels are: topics on kafka, queues on azure.storage-queue. A channel in a broker whose kind carries one kind of channel can also be created by the connection that names it. See Broker and channel.

Say what travels​

An event says what happened, and is declared in the component that publishes it. A command asks one component to do something, and a query asks it for something; both are declared in the component that handles them. Each is about a domain object, which is required. carries, after every other part of a connection, names what it carries. Declare the order, where the order service holds it, and the event it publishes to the warehouse:

ecosystem shop "Shop" { domain selling "Selling" platform storefront "Storefront" { object order "Order" : selling component web-shop "Web Shop" : user-facing-app component order-service "Order Service" : backend { event order-placed "Order placed" about order sql orders-db "Orders DB" { root order authoritative origin identifier "Order Id" } } component payments "Payments" : saas component warehouse "Warehouse" : backend broker events "Events" : kafka { channel orders "Orders" } web-shop -> order-service/orders-api over http/json auth user-token order-service -> payments/payments-api over http auth key order-service -> warehouse over events/orders sender-auth client-credentials receiver-auth client-credentials carries order-placed storefront realizes selling } }

A publisher holds what its event is about: an event about data its publisher holds nowhere is KQ114. See Writing events, commands and queries and What a connection carries, and Model the data for the order's holding.

Walk through a scenario​

A scenario is an ordered walk over connections you have already written, for one piece of behavior. It sits directly in the ecosystem. Each step names one connection by its ends, or one hop through a channel from the publisher to a subscriber, and may name the message it sends and a sentence saying what it does. Placing an order, first to last:

ecosystem shop "Shop" { domain selling "Selling" platform storefront "Storefront" { object order "Order" : selling component web-shop "Web Shop" : user-facing-app component order-service "Order Service" : backend { event order-placed "Order placed" about order sql orders-db "Orders DB" { root order authoritative origin identifier "Order Id" } } component payments "Payments" : saas component warehouse "Warehouse" : backend broker events "Events" : kafka { channel orders "Orders" } web-shop -> order-service/orders-api over http/json auth user-token order-service -> payments/payments-api over http auth key order-service -> warehouse over events/orders sender-auth client-credentials receiver-auth client-credentials carries order-placed storefront realizes selling } scenario place-order "Place an order" { step storefront/web-shop -> storefront/order-service/orders-api "Sends the order" step storefront/order-service -> storefront/payments/payments-api "Takes the payment" step storefront/order-service -> storefront/events/orders -> storefront/warehouse carries order-placed "Tells the warehouse to ship it" } }

A step creates nothing: the connection it names must exist, KQ240. See Writing a scenario.

See what you modeled​

The scenario view answers which system asks or tells which, in what order: a trimmed UML sequence diagram, with a lifeline per system and a row per step. Placing an order, drawn from the last step:

The diagram in words

Place an order · Scenario view

Scenario

  • Place an order

Taking part

  • Web Shop (User-facing app · Storefront)
  • Order Service (Backend · Storefront)
  • Payments (SaaS · Storefront)
  • Warehouse (Backend · Storefront)

Steps

  • Web Shop → Order Service: 1. Sends the order, http · orders-api, waits for an answer
  • Order Service → Payments: 2. Takes the payment, http · payments-api, waits for an answer
  • Order Service → Warehouse: 3. Tells the warehouse to ship it, through Orders, does not wait

In VS Code, the viewer draws it as you type. See Scenario view.

Where next​

© 2026 Extenza Works. All rights reserved.