• 周四. 10 月 3rd, 2024

5G编程聚合网

5G时代下一个聚合的编程学习网

热门标签

Dubbo solves local development direct connection

King Wang

1 月 3, 2022

problem :

In today’s distributed project development ,zookeeper + dubbo Is the most common , The usual use is to use zookeeper Be a registry ,dubbo do rpc, Then the service deployment can realize the remote communication between each other . So when developing a project , As long as the connection is for zk Development environment address , Local does not need to start all services can also call each other , It’s like there are three services A,B and C, as long as B and C All connected zk And deploy to the development environment ( Or other environments ), service A Configure the corresponding zk No need to start locally after message B and C Communication can also be achieved . But in the development process , Sometimes we may not want to access services on the registry , But directly in the local joint debugging dubbo Interface , For example, now I want to modify the service locally A and B, Then I want to do joint debugging A The service call B The effect of the service , But the call C The service is still on the registry , Then some processing is needed to bypass registry access B Yes .

solve :

The solution is simple , Under the local computer user, create a new one called dubbo-resolve.properties The file of , The path is a ${user.home}/dubbo-resolve.properties , Then configure the service information that needs direct connection in the file , There is no need to modify other configuration information of the local project ,

# Direct access to local services
com.xjt.order.facade.OrderFacade=dubbo://localhost:20890

发表回复