Edge services

An edge service is an intermediary component that is exposed to both the outside world and the downstream services. It works as a gateway that allows for interaction between all the services around it. The following diagram shows how an edge service is used:

An edge service

Note that all the incoming requests are pointing directly to the edge service, which will later look for the right service to redirect the request properly.

Edge services are used in different ways to add additional behavior or functionalities according to the services around them. The most common example is a cross-origin resource sharing (CORS) (https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS) filter. You can add a CORS filter to an edge service, and this would mean that the downstream services won't need to implement anything. Say that we only want to allow incoming requests from the domain abc.com. We can implement this logic as part of the edge service, as shown in the following diagram:

A CORS filter using an edge service

Here, we can see that all the logic is added in one place only, and that the downstream services don't have to implement anything to manage the required behavior.

Edge services are also used for many other requirements that we will discuss in the next section. Different implementations of edge services are available on the market. In the next section, we are going to talk about Netflix's Zuul, because it provides a smooth integration with Spring Cloud.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.141.200.3