- <?xml version="1.0" encoding="UTF-8"?>
- <!-- - Copyright 1999-2011 Alibaba Group. - - Licensed under the Apache License,
- Version 2.0 (the "License"); - you may not use this file except in compliance
- with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0
- - - Unless required by applicable law or agreed to in writing, software -
- distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT
- WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the
- License for the specific language governing permissions and - limitations
- under the License. -->
- <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 http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
- http://code.alibabatech.com/schema/dubbo http://code.alibabatech.com/schema/dubbo/dubbo.xsd">
- <!-- 引入spring配置 -->
- <import resource="applicationContext.xml" />
- <!-- 具體服務實現bean -->
- <bean id="userService" class="com.heli.user.service.impl.UserServiceImpl" />
- <!-- 將服務service封裝成可以對外開放的服務, 同時提供負載均衡算法,loadbalance可選有random,roundrobin(輪詢) -->
- <!--service中加入 mock="return null"當service所有都掛掉以後,client調用時自動獲取到return null -->
- <!--service中加入 actives="10" 表示限制所有服務在每個客戶端調用都不能同時超過10個 -->
- <!--service中加入 executes="10" 表示限制所有服務在每個服務器端被調用都不能同時超過10個 -->
- <!-- 可以在service中加入內部標籤 <dubbo:method name="sayHello" actives="10" />來控制每個方法的執行併發個數 -->
- <!-- timeout="300" retry="2" 超時時間300 重試2次 -->
- <!-- owner=”WangHeping,Guoyong”該服務的負責人 -->
- <dubbo:service interface="com.heli.user.service.IUserService" ref="userService" loadbalance="roundrobin" />
- <!-- 提供方應用信息,用於計算依賴關係,不要與消費方一樣 -->
- <dubbo:application name="MyFirstDubboProvider" />
- <!-- 使用multicast廣播註冊中心暴露服務地址 <dubbo:registry address="multicast://224.5.6.7:1234"
- /> -->
- <!-- 使用zookeeper註冊中心暴露服務地址 -->
- <dubbo:registry address="zookeeper://192.168.1.244:2181" />
- <!-- 用dubbo協議在20880端口暴露服務 ,注意不能與其他服務端口相同 -->
- <!-- dispatcher all所有請求都發到線程池處理,threadpool fixed固定線程池大小,初始化後不進行伸縮,threads 線程池內線程個數 -->
- <!-- <dubbo:protocol accesslog="true" />開啓訪問日誌記錄 -->
- <!-- <dubbo:protocol accesslog="http://10.20.160.198/wiki/display/dubbo/foo/bar.log" />規定訪問日誌的路徑 -->
- <!-- <dubbo:protocol name="dubbo" connections="2" accepts="1000"/> dubbo協議使用長連接和nio,這裏connections=2表示同時建立兩個長連接(要在provier和consumer同時寫上)
- accepts=1000 表示爲了防止同時過來大量連接而被幹掉,限制最大爲1000-->
- <dubbo:protocol name="dubbo" port="20880" dispatcher="all" threadpool="fixed" threads="100" />
- </beans>
dubbo服務者配置說明
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.