In essence, microservices are an architectural style that structures a system as a set of relatively small services. Each of these services has its own independent life cycle, and communication between them is usually built upon light-weight communication protocols. However, there don’t exist any standards regarding the structure of the microservices themselves. Each company, team, and/or developer is free to choose a design that fits their own unique requirements.
Although there is a large variety of design possibilities, practice shows that building microservices out of loosely-coupled components is the preferred way of getting things done. For example, the popular SpringBoot framework uses this very same approach. The Pip.Services toolkit doesn’t impose any restrictions on developers when it comes to structuring a microservice - each developer is free to choose their own path. However, it is worth noting that this componentized design is strongly supported in the Pip.Services toolkit. This approach empowers us to:
The typical structure of a microservice and its independent components is shown in the diagram below:
Basically, a microservice is a container that is composed of components, essential to that specific service. Components can generally be classified into the following groups:
Configuration files are often used for building microservices and configuring components in the Pip.Services toolkit. Below is an example of such a file:
A microservice’s container can read this configuration, use the descriptors in a factory to create all necessary components, provide these components with some configuration parameters, link the components with one another, and start up all available active processes.
This approach was used to implement The Pip.Services Library, which offers dozens of reusable microservices. And as a result, these microservices are all incredibly flexible: to configure them for a specific platform, all you need to do is provide them with the correct configuration, and you’re done! No coding needed!