Adding services to domains
Adding services to your domains is a great way to group services within a bounded context.
Grouped services within domains allows EventCatalog to visualize your domains.
Adding services using frontmatter​
To add services within a domain you need to add them to the services
array within your domain frontmatter API.
You need to add the id
and version
of the service.
---
id: PaymentDomain
... # other domain frontmatter
services:
# id of the service you want to add
- id: PaymentsService
# The version of the service you want to add.
version: 0.0.1
# Example of another service added to the domain
- id: NotificationsService
version: 0.0.1
---
<!-- Markdown contents... -->
The services
frontmatter in your domain tells EventCatalog that these documented services belong to this domain.
In the example above we can see that the services PaymentsService
and NotificationsService
belong to the PaymentDomain
.
You can choose which version of the service belongs to your domains. Documentation versioning gives you more flexibility when migrating your messages, domains and services.
Using semver versioning​
eventcatalog@2.4.0
You can use semver syntax when referencing your messages in your domains.
---
id: PaymentDomain
... # other domain frontmatter
services:
# Latest minor version of PaymentsService will be added
- id: PaymentsService
version: 0.x.1
# Minor and patches of this version will be linked
- id: NotificationsService
version: ^1.0.1
# Latest version of this service will be shown by default.
- id: PaymentsService
---
<!-- Markdown contents... -->
Although it's recommended to link to a version of a service it is now optional. If no version is given latest is used by default.
Visualizing domains and services​
When services get added within your domains EventCatalog will visualize this for you either using the NodeGraph
component or through the visualizer.
Making changes and versioning​
You can make as many changes as you want, but if you are adding/removing services you may want to consider versioning your domain. This allows you to keep historic changes, and let others understand why services are coming in/out of a particular domain.