Projects based on the Spring Framework are like high-rise buildings like The Shanghai Center, where a variety of companies and enterprises with diverse tenants provide a variety of services to users.
Every office in the building is a container, corresponding to a Docker container. An empty office has no meaning for users. It is called a microservice node only when Spring Boot is occupied and various programs are run inside.
The room number can be understood as the IP address and port of the container, and the enterprise name can be understood as the service name of the microservice. If an enterprise is large and needs to rent multiple offices, that is, multiple containers together form a highly available microservice group.
There is a list of enterprises in the building, which enterprises provide which services, and the corresponding room number. This list is Spring Cloud Eureka.
The gate of the building is the external gateway for all enterprises. Users can only enter through the gate and then go through security check. The security guard will help you to find the way and tell you where the enterprise is.
Not all of the rooms are for companies. There are also vulnerability rooms, tea rooms and other public facilities for all companies, such as Spring Cloud Hystrix’s Dashboard, Redis, MQ and other independent ancillary services.
If you want to visit a certain enterprise in the building, you only know the name of the enterprise, and you do not know the specific room on the floor, you need to look at the floor navigation map or Eureka list of enterprises near the elevator. If a company has more than one room, the customer decides which room to go to for service. This is the Spring Cloud Ribbon. If you don’t get the service you want from a particular business a few times today, you’ll try again later (a circuit breaker) or invite a few people to visit (request aggregation and dismantling). This is Spring Cloud Hystrix. If you are an important person, the above procedures for visiting an enterprise are not elegant enough. The building will arrange a special hostess to greet you at the elevator to improve customer satisfaction. This is Spring Cloud Feign.
If you enter the building at one time to visit more than one enterprise, when you enter which room, when you exit, and when you enter other rooms are recorded by the camera, and all of them take pictures of you, the mechanism is Spring Cloud Sleuth.
The property company of this building is GitHub, and the cleaning lady of all enterprises is assigned by Git. The cleaning lady decides what kind of carpet and hygiene level each enterprise changes every day. They are an organization independent of all enterprises but affecting all enterprises, and this product is called Spring Cloud Config. Of course, if the welfare of the property company is good enough, the cleaning lady lives in a collective apartment and has a Bus every day to and from work, Spring Cloud Bus will become Spring Cloud Bus.
It happened that room 701 was a leather manufacturer, while room 703 was a LV bag manufacturer. After the two companies signed an agreement, the person from 701 would send the materials to 703 when he got them. As a result, 701 was always asked to take them back because 703 had not finished his work and had no extra space for storage, so the two companies agreed to rent room 702. In leather production, the finished leather will be sent directly to Room 702. LV will fetch new materials from Room 702 once the bags are processed. Room 702 here is equivalent to a Kafka or RabbitMQ. The integration between 701 and 703 and between 702 is Spring Cloud Stream.