Dubbo 实例
POM:
<!-- Dubbo --> <dependency> <groupId>com.alibaba</groupId> <artifactId>dubbo</artifactId> <version>2.5.3</version> <exclusions> <exclusion> <groupId>org.springframework</groupId> <artifactId>spring</artifactId> </exclusion> </exclusions> </dependency>
提供者:
<?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:dubbo="http://code.alibabatech.com/schema/dubbo" xsi:schemaLocation="http://www.springframework.org/schema/beans classpath:/org/springframework/beans/factory/xml/spring-beans-4.1.xsd http://code.alibabatech.com/schema/dubbo classpath:META-INF/dubbo.xsd "> <dubbo:application name="ucenter"/> <dubbo:registry address="N/A" /> <dubbo:protocol name="dubbo" port="20880"></dubbo:protocol> <dubbo:service interface="com.ucenter.api.session.service.IWebSessionService" version="1.0" ref="webSessionService" /> <dubbo:service interface="com.ucenter.api.session.service.IAppSessionService" version="1.0" ref="appSessionService" /> <dubbo:service interface="com.ucenter.api.loa.service.ILoaResourceService" version="1.0" ref="loaResourceService" /> <dubbo:service interface="com.ucenter.api.loa.service.ILoaFunctionService" version="1.0" ref="loaFunctionService" /> <dubbo:service interface="com.ucenter.api.user.service.IUserService" version="1.0" ref="userService" /> <dubbo:service interface="com.ucenter.api.user.service.IUserAuthService" version="1.0" ref="userAuthService" /> <dubbo:service interface="com.ucenter.api.organization.service.IEmployeeService" version="1.0" ref="employeeService" /> <dubbo:service interface="com.ucenter.api.appuser.service.IAppuserService" version="1.0" ref="appuserService" /> <dubbo:reference id="houseService" interface="com.smart.server.api.house.service.IHouseService" url="dubbo://${dubbo.server.address}/com.smart.server.api.house.service.IHouseService" version="1.0" check="false" /> </beans>
消费者:
<?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:dubbo="http://code.alibabatech.com/schema/dubbo" xsi:schemaLocation="http://www.springframework.org/schema/beans classpath:/org/springframework/beans/factory/xml/spring-beans-4.1.xsd http://code.alibabatech.com/schema/dubbo classpath:META-INF/dubbo.xsd "> <dubbo:application name="ems" /> <dubbo:consumer timeout="30000"></dubbo:consumer> <dubbo:reference id="buildingService" interface="com.xindatai.resource.api.building.service.IBuildingService" url="dubbo://${dubbo.resource.address}/com.xindatai.resource.api.building.service.IBuildingService" version="1.0" check="false" /> <dubbo:reference id="floorService" interface="com.xindatai.resource.api.floor.service.IFloorService" url="dubbo://${dubbo.resource.address}/com.xindatai.resource.api.floor.service.IFloorService" version="1.0" check="false" /> <dubbo:reference id="regionService" interface="com.xindatai.resource.api.region.service.IRegionService" url="dubbo://${dubbo.resource.address}/com.xindatai.resource.api.region.service.IRegionService" version="1.0" check="false" /> <dubbo:reference id="devPM25Service" interface="com.xindatai.device.pm25.service.IDevPM25Service" url="dubbo://${dubbo.device.address}/com.xindatai.device.pm25.service.IDevPM25Service" version="1.0" check="false" /> <dubbo:reference id="devAirConService" interface="com.xindatai.device.aircon.service.IDevAirConService" url="dubbo://${dubbo.device.address}/com.xindatai.device.aircon.service.IDevAirConService" version="1.0" check="false" /> <dubbo:reference id="devAirCleanerService" interface="com.xindatai.device.aircleaner.service.IDevAirCleanerService" url="dubbo://${dubbo.device.address}/com.xindatai.device.aircleaner.service.IDevAirCleanerService" version="1.0" check="false" /> <dubbo:reference id="loaFunctionService" interface="com.ucenter.api.loa.service.ILoaFunctionService" url="dubbo://${dubbo.ucenter.address}/com.ucenter.api.loa.service.ILoaFunctionService" version="1.0" check="false" /> <dubbo:reference id="webSessionService" interface="com.ucenter.api.session.service.IWebSessionService" url="dubbo://${dubbo.ucenter.address}/com.ucenter.api.session.service.IWebSessionService" version="1.0" check="false" /> </beans>
啦啦啦
啦啦啦