In this section, we will show how to specify a group of services that share some common attributes and define a rule based on that grouping.
As a simple example let’s group oms and oms-trucking into a mail clients group since both services have flows that send mails through the mailsender service.
Hover the square dashed rectangle icon at the bottom the center pane (under the graph) and click on it until the tooltip shows Default Mode
Draw the square around oms and oms-trucking services, and in the dialog select Create Group and specify a group name: Mail Clients
In the dialog add a new tag for the group and call it mailclient, then click Save in the Create Group dialog.
Enable showing tags on the graph (like we enabled showing service labels and tech stacks). The graph should be similar to:
Now we can use the new tag applied on the group to create a new architectural rule. Create and dry-run the rule as shown here (apply the rules):
The rule enforces that every service tagged as mailclient must call the mailsender service.
In addition to groups, we can define a set of services as a subsystem - a logical component within the system that is composed of the set of services.
To demonstrate how to define and use a sub-system, lets create a subsystem called Shipping that contains the services oms-shipping and oms-inventory:
Hover the square dashed rectangle icon at the bottom the center pane (under the graph) and click on it until the tooltip shows Default Mode.
Draw the square around oms-shipping and oms-inventory services, in the dialog select Create Subsystem and specify the name: Shipping, then click SAVE in the dialog. The services graph should look similar to:
Click on SUB-SYSTEMS at the top of the graph - in this view the subsystems appear as a single component:
Click on the Shipping sub-system, you will see a list of the its services, and if you click VIEW SUB-SYSTEM it will show a graph of the its services.
Switch back SUB-SYSTEMS view of the analysis and open on of the flows by hovering over the lines attached to the shipping subsystem and selecting one of the service calls. You will see a sequence diagram where the subsystem is represented as a single lifeline.
Now, let’s delete the sub-system:
Go back and switch to the SERVICES view
Hover over the Shipping subsystem and delete it by clicking the trash can icon and then confirming the deletion in the popup dialog.