2、 Analysis of Dubbo’s service reference source code


We have made a general analysisDubbo registry and service registration source process

Now let’s analyze itService IntroductionThe process of

1、 Overall architecture diagram




2、 Service reference sequence diagram

3Consumption flow chart



As shown in the figure above, service consumption and service registration are also divided into two steps.

1. Convert referenceconfig to invoker

2. Convert invoker to ref

As with service registration, let’s take a look first org.apache.dubbo . config.spring.ReferenceBean The relationship of inheritance



Now let’s take a look org.apache.dubbo . config.ReferenceConfig Specific code of




Take another look at the init method



Take a look org.apache.dubbo . config.ReferenceConfig#createProxy method






There are several main things to do here

1. Get all service references

2. Get the list of all invockers

3. Select a specific invoker (routing, load balancing) through cluster

4. Create a service proxy

So far, we have finished reading the consumption process code of Dubbo