多协议支持
负载均衡
集群容错
多协议支持
RMI协议
Hessian协议
HTTP协议
WebService协议
Thrift协议
Memcached协议
Redis协议
Rest协议
同一服务支持多种协议
不同服务使用不同协议
<?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://dubbo.apache.org/schema/dubbo"xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://dubbo.apache.org/schema/dubbo http://dubbo.apache.org/schema/dubbo/dubbo.xsd"><dubbo:application name="provider-version"/><dubbo:registry address="zookeeper://zkOS:2181"/><!--注册Service实现类--><bean id="oldService" class="com.eleven.provider.OldServiceImpl"/><bean id="newService" class="com.eleven.provider.NewServiceImpl"/><!--暴露服务--><dubbo:service interface="com.eleven.service.SomeService"ref="oldService" version="0.0.1"/><dubbo:service interface="com.eleven.service.SomeService"ref="newService" version="0.0.2" protocol="dubbo,rmi"/></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://dubbo.apache.org/schema/dubbo"xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://dubbo.apache.org/schema/dubbo http://dubbo.apache.org/schema/dubbo/dubbo.xsd"><dubbo:application name="consumer-version"/><dubbo:registry address="zookeeper://zkOS:2181" ><!--指定消费0.0.1版本,即oldService提供者--><!--<dubbo:reference id="someService" version="0.0.1"--><!--interface="com.eleven.service.SomeService"/>--><!--指定消费0.0.2版本,即newService提供者--><dubbo:reference id="someService" version="0.0.2" protocol="rmi"interface="com.eleven.service.SomeService"/></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://dubbo.apache.org/schema/dubbo"xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://dubbo.apache.org/schema/dubbo http://dubbo.apache.org/schema/dubbo/dubbo.xsd"><dubbo:application name="provider-group"/><dubbo:registry address="zookeeper://zkOS:2181"/><!--注册Service实现类--><bean id="weixinService" class="com.eleven.provider.WeixinServiceImpl"/><bean id="zhifubaoService" class="com.eleven.provider.ZhifubaoServiceImpl"/><!--暴露服务--><dubbo:service interface="com.eleven.service.SomeService"ref="weixinService" group="pay.weixin" protocol="dubbo"/><dubbo:service interface="com.eleven.service.SomeService"ref="zhifubaoService" group="pay.zhifubao" protocol="rmi"/></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://dubbo.apache.org/schema/dubbo"xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://dubbo.apache.org/schema/dubbo http://dubbo.apache.org/schema/dubbo/dubbo.xsd"><dubbo:application name="consumer-group"/><dubbo:registry address="zookeeper://zkOS:2181" ><!--指定调用微信服务--><dubbo:reference id="weixin" group="pay.weixin"interface="com.eleven.service.SomeService" protocol="dubbo"/><!--指定调用支付宝服务--><dubbo:reference id="zhifubao" group="pay.zhifubao"interface="com.eleven.service.SomeService" protocol="rmi"/></beans>
负载均衡
random
roundrobin
leastactive
consistenthash
<?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://dubbo.apache.org/schema/dubbo"xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://dubbo.apache.org/schema/dubbo http://dubbo.apache.org/schema/dubbo/dubbo.xsd"><dubbo:application name="consumer-version"/><dubbo:registry address="zookeeper://zkOS:2181" ><!--指定消费0.0.1版本,即oldService提供者--><dubbo:reference id="someService" version="0.0.1"interface="com.eleven.service.SomeService"loadbalance="roundrobin"/><!--指定消费0.0.2版本,即newService提供者--><dubbo:reference id="someService" version="0.0.2" protocol="rmi"interface="com.eleven.service.SomeService"/><dubbo:method name="hello" loadbalance="roundrobin"/><dubbo:method name="doFirst" loadbalance="random"/><dubbo:method name="doFirst" loadbalance="leastactive"/></beans>
集群容错
Failover
Failfast
Failsafe
Failback
Forking
Broadcast
失败自动恢复策略。消费者调用提供者失败后,Dubbo 会记录下该失败请求,然后定时自动重新发送该请求。该策略通常用于实时性要求不太高的服务,例如消息通知操作。
<?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://dubbo.apache.org/schema/dubbo"xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://dubbo.apache.org/schema/dubbo http://dubbo.apache.org/schema/dubbo/dubbo.xsd"><dubbo:application name="provider-version"/><dubbo:registry address="zookeeper://zkOS:2181"/><!--注册Service实现类--><bean id="oldService" class="com.eleven.provider.OldServiceImpl"/><bean id="newService" class="com.eleven.provider.NewServiceImpl"/><!--暴露服务--><dubbo:service interface="com.eleven.service.SomeService"ref="oldService" version="0.0.1" retries="2" cluster="failfast"><dubbo:method name="hello" retries="2"/><dubbo:service></beans>
文章转载自Alleria Windrunner,如果涉嫌侵权,请发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。




