dubbo服务者配置说明

  1. <?xml version="1.0" encoding="UTF-8"?>  
  2. <!-- - Copyright 1999-2011 Alibaba Group. - - Licensed under the Apache License,   
  3.     Version 2.0 (the "License"); - you may not use this file except in compliance   
  4.     with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0   
  5.     - - Unless required by applicable law or agreed to in writing, software -   
  6.     distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT   
  7.     WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the   
  8.     License for the specific language governing permissions and - limitations   
  9.     under the License. -->  
  10. <beans xmlns="http://www.springframework.org/schema/beans"  
  11.     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:dubbo="http://code.alibabatech.com/schema/dubbo"  
  12.     xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd  
  13.     http://code.alibabatech.com/schema/dubbo http://code.alibabatech.com/schema/dubbo/dubbo.xsd">  
  14.       
  15.     <!-- 引入spring配置 -->  
  16.     <import resource="applicationContext.xml" />  
  17.     <!-- 具体服务实现bean -->  
  18.     <bean id="userService" class="com.heli.user.service.impl.UserServiceImpl" />  
  19.     <!-- 将服务service封装成可以对外开放的服务, 同时提供负载均衡算法,loadbalance可选有random,roundrobin(轮询) -->  
  20.     <!--service中加入   mock="return null"当service所有都挂掉以后,client调用时自动获取到return null -->  
  21.     <!--service中加入 actives="10" 表示限制所有服务在每个客户端调用都不能同时超过10个 -->  
  22.     <!--service中加入  executes="10" 表示限制所有服务在每个服务器端被调用都不能同时超过10个 -->  
  23.     <!-- 可以在service中加入内部标签   <dubbo:method name="sayHello" actives="10" />来控制每个方法的执行并发个数 -->  
  24.     <!-- timeout="300" retry="2" 超时时间300    重试2次 -->  
  25.     <!-- owner=”WangHeping,Guoyong”该服务的负责人 -->  
  26.     <dubbo:service interface="com.heli.user.service.IUserService" ref="userService" loadbalance="roundrobin" />  
  27.     <!-- 提供方应用信息,用于计算依赖关系,不要与消费方一样 -->  
  28.     <dubbo:application name="MyFirstDubboProvider" />  
  29.     <!-- 使用multicast广播注册中心暴露服务地址 <dubbo:registry address="multicast://224.5.6.7:1234"   
  30.         /> -->  
  31.     <!-- 使用zookeeper注册中心暴露服务地址 -->  
  32.     <dubbo:registry address="zookeeper://192.168.1.244:2181" />  
  33.     <!-- 用dubbo协议在20880端口暴露服务 ,注意不能与其他服务端口相同  -->  
  34.     <!-- dispatcher all所有请求都发到线程池处理,threadpool fixed固定线程池大小,初始化后不进行伸缩,threads 线程池内线程个数 -->  
  35.     <!-- <dubbo:protocol accesslog="true" />开启访问日志记录 -->  
  36.     <!-- <dubbo:protocol accesslog="http://10.20.160.198/wiki/display/dubbo/foo/bar.log" />规定访问日志的路径 -->  
  37.     <!-- <dubbo:protocol name="dubbo" connections="2" accepts="1000"/> dubbo协议使用长连接和nio,这里connections=2表示同时建立两个长连接(要在provier和consumer同时写上)  
  38.         accepts=1000  表示为了防止同时过来大量连接而被干掉,限制最大为1000-->  
  39.     <dubbo:protocol name="dubbo" port="20880" dispatcher="all" threadpool="fixed" threads="100" />  
  40.   
  41. </beans>  
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值