Publishing and calling of dubbo services

  Dubbo is a distributed service architecture and an excellent open source service-oriented framework, which enables applications to realize the input and output functions of services through high-performance RPC. In fact, dubbo is a management tool for resource scheduling and governance centers.

Publish dubbo service: Publish the service in the application that provides the service

<!-- spring and service integration-->

<!-- Configure global annotation scan-->
<context:component-scan base-package="nyist.e3.service"></context:component-scan>
<!-- Use dubbo to publish service-->
<! -- 1. Name of the application providing the service: generally the name of the project that publishes the service (can be optional) -->
<dubbo:application name="e3-manager" />
<!--2. Register the service on zookeeper :address: The ip address of the machine where the zookeeper registry is located: 2181 (the port number is 2181 by default), using the zookeeper protocol -->
<dubbo:registry address="ip:2181" protocol="zookeeper" />
<!- - 3. The port er of the exposed service, the default is 20080 -->
<dubbo:protocol name="dubbo" port="20080"></dubbo:protocol>
<!-- 4. Declare the service interface that needs to be exposed to serve The interface is placed in the zookeeper registry -->
<dubbo:service interface= "The fully qualified name of the package where the interface is located " ref="tbItemServiceImpl"timeout="600000"></dubbo:service>
</beans>

 Dubbo service call:

<!-- As a client: refer to the dubbo service-->
<!-- Step 1: configure the name of the application calling the service-->
<dubbo:application name="e3-manager-web" />
<!- - Step 2: Configure the registry -->
<dubbo:registry address="The ip address of the machine where the registry is located: 2181" protocol="zookeeper"></dubbo:registry>
<!-- Refer to the specific services provided Interface -->
<dubbo:reference interface="The fully qualified name of the package where the service interface is located" id="tbItemService"></dubbo:reference>

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324615280&siteId=291194637
Recommended