设为首页 加入收藏

TOP

再探motan(三)
2019-09-17 17:56:07 】 浏览:73
Tags:再探 motan
;

<motan:referer/>

调用方对象,motan:referer包含以下常用属性:

  • id:标识配置项
  • group:标识服务的分组
  • module:标识模块信息
  • protocol:标识referer使用的协议,与motan:protocol中的name对应,默认为Motan协议
  • registry:标识referer使用的注册中心,与motan:registry中的name对应
  • basicReferer:标识使用的基本配置,引用motan:basicReferer对象

Client端订阅Service后,会从Registry中得到能够提供对应Service的一组Server,Client把这一组Server看作一个提供服务的cluster。当cluster中的Server发生变更时,Client端的register模块会通知Client进行更新。

<motan:basicReferer/>

调用方基础配置。用于配置所有服务代理的公共属性。

  • id:标识配置项
  • group:标识服务的分组
  • module:标识模块信息
  • protocol:标识referer使用的协议,与motan:protocol中的name对应,默认为Motan协议
  • registry:标识referer使用的注册中心,与motan:registry中的name对应

motan:referer可以通过以下方式引用基本配置。

<!-- 通用referer基础配置 -->
<motan:basicReferer id="clientBasicConfig" group="motan-demo-rpc" module="motan-demo-rpc"  registry="registry" protocol="motan"/>

<!-- 具体referer配置。使用方通过beanid使用服务接口类 -->
<motan:referer id="demoReferer" interface="com.weibo.motan.demo.service.MotanDemoService"  basicReferer="clientBasicConfig"/>

 

motan:referer中的basicService属性用来标识引用哪个motan:basicReferer对象,对于basicReferer中已定义的内容,service不必重复配置。

下表是referer的所有属性说明:

 

Property name Type Default Comment
id String   服务引用 BeanId
protocol String motan 使用的协议
interface Class   服务接口名
client String   客户端类型
directUrl String   点对点直连服务提供地址
basicReferer String   基本 referer 配置
extConfig String   扩展配置
proxy String   代理类型
group String default_rpc 服务分组
version String 1.0 版本
throwException String true 抛出异常
requestTimeout String 200 请求超时时间(毫秒)
connectTimeout String 1000 连接超时时间(毫秒)
retries int 0 重试次数
filter String   过滤器配置
listener String   监听器配置
connections int   连接数限制,0表示共享连接,否则为该服务独享连接数;默认共享
application String motan 应用信息
module String motan 模块信息
shareChannel boolean false 是否共享channel
timeout int   (目前未用)方法调用超时时间
actives int 0 最大请求数,0为不做并发限制
async boolean false 方法是否异步
mock String false 设为true,表示使用缺省Mock类名,即:接口名+Mock 后缀,服务接口调用失败Mock实现类
check boolean true 检查服务提供者是否存在
registry String   注册中心的id 列表,多个用“,”分隔,如果为空,则使用所有的配置中心
register boolean true 在该注册中心上服务是否暴露
subscribe boolean true 在该注册中心上服务是否引用
accessLog String false 设为true,将向logger 中输出访问日志
usegz boolean false 是否开启gzip压缩.只有compressMotan的codec才能支持
mingzSize int 1000 开启gzip压缩的阈值.usegz开关开启,且传输数据大于此阈值时,才会进行gzip压缩。只有compressMotan的codec才能支持
codec String motan 协议编码
首页 上一页 1 2 3 下一页 尾页 3/3/3
】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
上一篇消息中间件初识 下一篇【代码总结● Swing中的一些操作..

最新文章

热门文章

Hot 文章

Python

C 语言

C++基础

大数据基础

linux编程基础

C/C++面试题目