61
CHAPTER 3 | Architecting container and microservice-based applications
consuming the microservices, which just focus on logic and data and not on the UI shape (HTML and
JavaScript).
Figure 4-20. A monolithic UI application consuming back-end microservices
In contrast, a composite UI is precisely generated and composed by the microservices themselves.
Some of the microservices drive the visual shape of specific areas of the UI. The key difference is that
you have client UI components (TypeScript classes, for example)
based on templates, and the data-
shaping-UI ViewModel for those templates comes from each microservice.
At client application start-up time, each of the client UI components (TypeScript classes, for example)
registers itself with an infrastructure microservice capable of providing ViewModels for a given
scenario. If the microservice changes
the shape, the UI changes also.
Figure 4-21 shows a version of this composite UI approach. This approach is simplified because you
might have other microservices that are aggregating granular parts that are based on different
tech
niques. It depends on whether you’re building a traditional web approach (ASP.NET MVC) or an
SPA (Single Page Application).
62
CHAPTER 3 | Architecting container and microservice-based applications
Figure 4-21. Example of a composite UI application shaped by back-end microservices
Each of those UI composition microservices would be similar to a small API Gateway.
But in this case,
each one is responsible for a small UI area.
A composite UI approach that’s driven by microservices can be more challenging or less so,
depending on what UI technologies you’re using. For instance, you won’t use the same techniques for
building a traditional web application that you use for building an SPA or for native mobile app (as
when developing Xamarin apps, which can be more challenging for this approach).
The
eShopOnContainers
sample application uses the monolithic UI approach for multiple reasons.
First, it’s an introduction to microservices and containers. A composite UI
is more advanced but also
requires further complexity when designing and developing the UI. Second, eShopOnContainers also
provides a native mobile app based on Xamarin, which would make it more complex on the client C#
side.
However, we encourage you to use the following references to learn more about composite UI based
on microservices.
Dostları ilə paylaş: