日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問(wèn) 生活随笔!

生活随笔

當(dāng)前位置: 首頁(yè) > 编程资源 > 编程问答 >内容正文

编程问答

Dubbo xml配置 和注解配置 写法

發(fā)布時(shí)間:2023/12/10 编程问答 41 豆豆
生活随笔 收集整理的這篇文章主要介紹了 Dubbo xml配置 和注解配置 写法 小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.
<?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" />
<!-- 具體服務(wù)實(shí)現(xiàn)bean -->
<bean id="userService" class="com.xxx.user.service.impl.UserServiceImpl" />
<!-- 將服務(wù)service封裝成可以對(duì)外開(kāi)放的服務(wù), 同時(shí)提供負(fù)載均衡算法,loadbalance可選有random,roundrobin(輪詢) -->
<!--service中加入 mock="return null"當(dāng)service所有都掛掉以后,client調(diào)用時(shí)自動(dòng)獲取到return null -->
<!--service中加入 actives="10" 表示限制所有服務(wù)在每個(gè)客戶端調(diào)用都不能同時(shí)超過(guò)10個(gè) -->
<!--service中加入 executes="10" 表示限制所有服務(wù)在每個(gè)服務(wù)器端被調(diào)用都不能同時(shí)超過(guò)10個(gè) -->
<!-- 可以在service中加入內(nèi)部標(biāo)簽 <dubbo:method name="sayHello" actives="10" />來(lái)控制每個(gè)方法的執(zhí)行并發(fā)個(gè)數(shù) -->
<!-- timeout="300" retry="2" 超時(shí)時(shí)間300 重試2次 -->
<!-- owner=”WangHeping,Guoyong”該服務(wù)的負(fù)責(zé)人 -->
<dubbo:service interface="com.xxx.user.service.IUserService" ref="userService" loadbalance="roundrobin" />
<!-- 提供方應(yīng)用信息,用于計(jì)算依賴關(guān)系,不要與消費(fèi)方一樣 -->
<dubbo:application name="MyFirstDubboProvider" />
<!-- 使用multicast廣播注冊(cè)中心暴露服務(wù)地址 <dubbo:registry address="multicast://224.5.6.7:1234"
/> -->
<!-- 使用zookeeper注冊(cè)中心暴露服務(wù)地址 -->
<dubbo:registry address="zookeeper://192.168.1.244:2181" />
<!-- 用dubbo協(xié)議在20880端口暴露服務(wù) ,注意不能與其他服務(wù)端口相同 -->
<!-- dispatcher all所有請(qǐng)求都發(fā)到線程池處理,threadpool fixed固定線程池大小,初始化后不進(jìn)行伸縮,threads 線程池內(nèi)線程個(gè)數(shù) -->
<!-- <dubbo:protocol accesslog="true" />開(kāi)啟訪問(wèn)日志記錄 -->
<!-- <dubbo:protocol accesslog="http://10.20.160.198/wiki/display/dubbo/foo/bar.log" />規(guī)定訪問(wèn)日志的路徑 -->
<!-- <dubbo:protocol name="dubbo" connections="2" accepts="1000"/> dubbo協(xié)議使用長(zhǎng)連接和nio,這里connections=2表示同時(shí)建立兩個(gè)長(zhǎng)連接(要在provier和consumer同時(shí)寫上)
accepts=1000 表示為了防止同時(shí)過(guò)來(lái)大量連接而被干掉,限制最大為1000-->
<dubbo:protocol name="dubbo" port="20880" dispatcher="all" threadpool="fixed" threads="100" />

</beans>

轉(zhuǎn)載于:https://www.cnblogs.com/wangdaijun/p/6026551.html

總結(jié)

以上是生活随笔為你收集整理的Dubbo xml配置 和注解配置 写法的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。

如果覺(jué)得生活随笔網(wǎng)站內(nèi)容還不錯(cuò),歡迎將生活随笔推薦給好友。