搭建dubbo客户端
1、搭建dubbo所需jar包
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>dubbo</artifactId>
<version>${dubbo.version}</version>
</dependency>
<dependency>
<groupId>org.apache.zookeeper</groupId>
<artifactId>zookeeper</artifactId>
<version>${zookeeper.version}</version>
</dependency>
<dependency>
<groupId>com.github.sgroschupf</groupId>
<artifactId>zkclient</artifactId>
<version>${zookeeper.client.version}</version>
</dependency>
2、和spring.xml结合使用
<dubbo:application name="${dubbo.application.name}" />
<!-- registry address, used for service to register itself -->
<dubbo:registry protocol="zookeeper" address="${dubbo.registry.address}" />
<import resource="/config/dubbo/dubbo-references.xml" />
3、dubbo-referencer.xml (开放api包)
<!-- 生成远程服务代理,可以和本地bean一样使用-->
<dubbo:reference id="omsSmsSettingService"
interface="cn.haiwaigo.service.IOmsSmsSettingService" timeout="${dubbo.server.timeout}"
check="false" />
4、dubbo.properties 配置
dubbo.application.name=customer-service
dubbo.registry.address=127.0.0.1:2181
dubbo.server.timeout=60000