In What’s a service - part 1? I described the key aspects of a service, which includes its API, and its dependencies. A good way to document a service and its structure is to use a microservice canvas. A microservice canvas is concise description of a service. It’s similar to a CRC card that’s sometime used in object-oriented design.
I first read about the canvas back in 2017 in an DZone article by Matt McLarty and Irakli Nadareishvili. I’ve since adapted the structure of the canvas so that it emphasizes the interface (top of the canvas) and the dependencies (bottom of the canvas) and de-emphasizes implementation (middle of the canvas).
Here is an example of a microservice canvas. It describes the Order Service, which is part of my book’s example FTGO application.
A service’s external viewThe service’s external view is described by the following sections:
- name - name of the service
- description - a brief description of the service
- capabilities - the business capabilities implemented by the service
- service API - the operations implemented by the service and the domain events published by the service
- quality attributes - the service’s quality attributes, which are also known as non-functional attributes
- observability - includes health check endpoint, key metrics, etc.
A service’s dependenciesA service’s dependencies are described by the dependencies section, which consists of two parts
- invokes - the operations, which are implemented by other services that this service invokes
- subscribes - the messages, which includes events, that this service subscribes to
A service’s implementation
The canvas can also describe the service’s implementation, such as its domain model.
- Take a look at the example canvas.
To learn more
- My book Microservices patterns
- The FTGO application, which is my book’s example application
- Use this template which is available on GitHub.
- Credit both Chris & Matt.
- Closely matches what I use anyway but a lot better laid out.
- Most of these metadata fields are already completed.
- The existing project documentation generator could easily work with this template to batch output HTML and PDF files.
- Will not be using Saga's, however, can work with workflow messaging.
Post a Comment