Applications composed of many microservices need a infrastructure layer for service to service communication: to control the delivery of service requests to other services, to perform load balancing, and to discover other services.

Although you can code the logic that governs communication directly into the microservices, a Kumori Service Link,window=_blank is the recommended way to connect services in the same deployment environment due to it abstracts and externalizes the services connections configuration.

Kumori Service Links main benefits:

1 Create services connections

For easy understanding, in this guide we’ll see how to connect the REST API service deployed in the Deploy a service REST API,window=_blank guide, to the MongoDB service deployed in the Deploy a service database,window=_blank guide.

Open the Developer submenu,window=_blank. Click on Link services.

1.1 Select the environment

First, select the environment on which the services to connect are running. For example, select the tenant Freemium, the account freemium, and the environment freemium.

1.3 Connect the services above

Finally, for each connection:

  1. Select the service or link name of the service that will act as client, following the previous example, select the REST API service which is the service that is a client of the database service.

  2. Set the client channel (in the example, in the REST API service) that will be connected to the server channel in the target service.

  3. Select the service or link name of the service that will act as server, following the example, select the database service which will receive the TCP calls from REST API.

  4. Set the server channel (in the example, in the database service) that will be connected to the client channel.

Click Link. This process will take a few minutes.

Go to any of the linked services card in the Runtime Dashboard, for example the REST API service card, and open the card menu.

Click on Links option and check both services are connected.

Congratulations, you successfully connected the REST API to the database in just a few minutes.