【DUBBO】dubbo的registry配置
【一】:配置项
注册中心地址:zookeeper://ip:端口
<dubbo:registry address="注册中心的地址" check="启动时检查注册中心是否存在" register="在该注册中心上服务是否暴露"/>
【二】:配置解析器
-->具体解析器为com.alibaba.dubbo.config.spring.schema.DubboNamespaceHandler配置的com.alibaba.dubbo.config.spring.schema.DubboBeanDefinitionParser、
【三】:配置目标
-->这个配置会想IOC容器中注册一个bean,该class为com.alibaba.dubbo.config.RegistryConfig
-->这个bean描述当前项目的注册中心的地址,用户名,密码等信息
-->描述的属性:id,address(注册中心地址),username(注册中心登陆用户名),password(注册中心登陆密码),port(注册中心端口号),protocol(注册中心协议),transporter(注册中心客户端实现),timeout(注册中心请求超时时间(毫秒)),session(注册中心会话超时时间(毫秒)),file(动态注册中心列表存储文件)
,wait(停止时等候完成通知时间),check(启动时检查注册中心是否存在),dynamic(在该注册中心上注册是动态的还是静态的服务),register(在该注册中心上服务是否暴露),subscribe(在该注册中心上服务是否引用),parameters(自定义参数),isDefault(是否为缺省),server(服务端),client(客户端),cluster(集群),group(分组),version(版本)
【四】:类
/*
* 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.
*/
package com.alibaba.dubbo.config; import java.util.Map; import com.alibaba.dubbo.common.Constants;
import com.alibaba.dubbo.config.support.Parameter;
import com.alibaba.dubbo.registry.support.AbstractRegistryFactory; /**
* RegistryConfig
*
* @author william.liangf
* @export
*/
public class RegistryConfig extends AbstractConfig { private static final long serialVersionUID = 5508512956753757169L; public static final String NO_AVAILABLE = "N/A"; // 注册中心地址
private String address; // 注册中心登录用户名
private String username; // 注册中心登录密码
private String password; // 注册中心缺省端口
private Integer port; // 注册中心协议
private String protocol; // 客户端实现
private String transporter; private String server; private String client; private String cluster; private String group; private String version; // 注册中心请求超时时间(毫秒)
private Integer timeout; // 注册中心会话超时时间(毫秒)
private Integer session; // 动态注册中心列表存储文件
private String file; // 停止时等候完成通知时间
private Integer wait; // 启动时检查注册中心是否存在
private Boolean check; // 在该注册中心上注册是动态的还是静态的服务
private Boolean dynamic; // 在该注册中心上服务是否暴露
private Boolean register; // 在该注册中心上服务是否引用
private Boolean subscribe; // 自定义参数
private Map<String, String> parameters; // 是否为缺省
private Boolean isDefault; public RegistryConfig() {
} public RegistryConfig(String address) {
setAddress(address);
} public String getProtocol() {
return protocol;
} public void setProtocol(String protocol) {
checkName("protocol", protocol);
this.protocol = protocol;
} @Parameter(excluded = true)
public String getAddress() {
return address;
} public void setAddress(String address) {
this.address = address;
} public Integer getPort() {
return port;
} public void setPort(Integer port) {
this.port = port;
} public String getUsername() {
return username;
} public void setUsername(String username) {
checkName("username", username);
this.username = username;
} public String getPassword() {
return password;
} public void setPassword(String password) {
checkLength("password", password);
this.password = password;
} /**
* @deprecated
* @see com.alibaba.dubbo.config.ProviderConfig#getWait()
* @return wait
*/
@Deprecated
public Integer getWait() {
return wait;
} /**
* @deprecated
* @see com.alibaba.dubbo.config.ProviderConfig#setWait(Integer)
* @param wait
*/
@Deprecated
public void setWait(Integer wait) {
this.wait = wait;
if( wait!=null && wait>0)
System.setProperty(Constants.SHUTDOWN_WAIT_KEY, String.valueOf(wait));
} public Boolean isCheck() {
return check;
} public void setCheck(Boolean check) {
this.check = check;
} public String getFile() {
return file;
} public void setFile(String file) {
checkPathLength("file", file);
this.file = file;
} /**
* @deprecated
* @see #getTransporter()
* @return transport
*/
@Deprecated
@Parameter(excluded = true)
public String getTransport() {
return getTransporter();
} /**
* @deprecated
* @see #setTransporter(String)
* @param transport
*/
@Deprecated
public void setTransport(String transport) {
setTransporter(transport);
} public String getTransporter() {
return transporter;
} public void setTransporter(String transporter) {
checkName("transporter", transporter);
/*if(transporter != null && transporter.length() > 0 && ! ExtensionLoader.getExtensionLoader(Transporter.class).hasExtension(transporter)){
throw new IllegalStateException("No such transporter type : " + transporter);
}*/
this.transporter = transporter;
} public String getServer() {
return server;
} public void setServer(String server) {
checkName("server", server);
/*if(server != null && server.length() > 0 && ! ExtensionLoader.getExtensionLoader(Transporter.class).hasExtension(server)){
throw new IllegalStateException("No such server type : " + server);
}*/
this.server = server;
} public String getClient() {
return client;
} public void setClient(String client) {
checkName("client", client);
/*if(client != null && client.length() > 0 && ! ExtensionLoader.getExtensionLoader(Transporter.class).hasExtension(client)){
throw new IllegalStateException("No such client type : " + client);
}*/
this.client = client;
} public Integer getTimeout() {
return timeout;
} public void setTimeout(Integer timeout) {
this.timeout = timeout;
} public Integer getSession() {
return session;
} public void setSession(Integer session) {
this.session = session;
} public Boolean isDynamic() {
return dynamic;
} public void setDynamic(Boolean dynamic) {
this.dynamic = dynamic;
} public Boolean isRegister() {
return register;
} public void setRegister(Boolean register) {
this.register = register;
} public Boolean isSubscribe() {
return subscribe;
} public void setSubscribe(Boolean subscribe) {
this.subscribe = subscribe;
} public String getCluster() {
return cluster;
} public void setCluster(String cluster) {
this.cluster = cluster;
} public String getGroup() {
return group;
} public void setGroup(String group) {
this.group = group;
} public String getVersion() {
return version;
} public void setVersion(String version) {
this.version = version;
} public Map<String, String> getParameters() {
return parameters;
} public void setParameters(Map<String, String> parameters) {
checkParameterName(parameters);
this.parameters = parameters;
} public Boolean isDefault() {
return isDefault;
} public void setDefault(Boolean isDefault) {
this.isDefault = isDefault;
} public static void destroyAll() {
AbstractRegistryFactory.destroyAll();
} @Deprecated
public static void closeAll() {
destroyAll();
} }
【DUBBO】dubbo的registry配置的更多相关文章
- dubbo框架----初探索-配置
使用框架版本 dubbo-2.5.3 spring-4.2.1.RELEASE jdk-1.8 tomcat-8.0 zookeeper-3.3.6 Dubbo与Zookeeper.SpringMVC ...
- Dubbo中对Spring配置标签扩展
Spring提供了可扩展Schema的支持,完成一个自定义配置一般需要以下步骤: 设计配置属性和JavaBean 编写XSD文件 编写NamespaceHandler和BeanDefinitionPa ...
- [dubbo] Dubbo API 笔记——配置参考
schema 配置参考 所有配置项分为三大类 服务发现:表示该配置项用于服务的注册与发现,目的是让消费方找到提供方 服务治理:表示该配置项用于治理服务间的关系,或为开发测试提供便利条件 性能调优:表示 ...
- dubbo的几种配置方式(转)
昨天刚接触公司dubbo,发现公司中项目里面的spring-dubbo-privider的dubbo中<dubbo:application name=""/>和< ...
- Dubbo -- 系统学习 笔记 -- 配置
Dubbo -- 系统学习 笔记 -- 目录 配置 Xml配置 属性配置 注解配置 API配置 配置 Xml配置 配置项说明 :详细配置项,请参见:配置参考手册 API使用说明 : 如果不想使用Spr ...
- Dubbo -- 系统学习 笔记 -- 配置参考手册
Dubbo -- 系统学习 笔记 -- 目录 配置参考手册 <dubbo:service/> <dubbo:reference/> <dubbo:protocol/> ...
- 初识Dubbo 系列之6-Dubbo 配置
配置 Xml配置 配置项说明 具体配置项,请參见:配置參考手冊 (+) API使用说明 假设不想使用Spring配置.而希望通过API的方式进行调用,请參见:API配置 (+) 配置使用说明 想知道怎 ...
- dubbo zookeeper图解入门配置
这次主要是对dubbo 和zookeeper的配置做个记录,以便以后自己忘记了,或者踩的坑再次被踩 快速阅读 zookeerer类似 springcloud中的Eureka都做为注册中心,用srpin ...
- 简单读读源码 - dubbo多提供者(provider)配置方法
简单读读源码 - dubbo多提供者(provider)配置方法 消费者端dubbo的yml配置 dubbo: consumer: timeout: 300000 protocol: name: du ...
- Dubbo | Dubbo快速上手笔记 - 环境与配置
目录 前言 1. Dubbo相关概念 1.1 自动服务发现工作原理 2. 启动文件 2.1 zookeeper-3.4.11\bin\zkServer.cmd 2.2 zookeeper-3.4.11 ...
随机推荐
- ctci1.3
; i < len; i++){ if(str0[i] != str1[i]) return false; } return t ...
- LabVIEW之生产者/消费者模式--队列操作
LabVIEW之生产者/消费者模式--队列操作 彭会锋 本文章主要是对学习LabVIEW之生产者/消费者模式的学习笔记,其中涉及到同步控制技术-队列.事件.状态机.生产者-消费者模式,这几种技术在在本 ...
- 《深入理解mybatis原理3》 Mybatis数据源与连接池
<深入理解mybatis原理> Mybatis数据源与连接池 对于ORM框架而言,数据源的组织是一个非常重要的一部分,这直接影响到框架的性能问题.本文将通过对MyBatis框架的数据源结构 ...
- 搞懂分布式技术12:分布式ID生成方案
搞懂分布式技术12:分布式ID生成方案 ## 转自: 58沈剑 架构师之路 2017-06-25 一.需求缘起 几乎所有的业务系统,都有生成一个唯一记录标识的需求,例如: 消息标识:message-i ...
- tkinter模块常用参数
tkinter模块常用参数 1.使用tkinter.Tk() 生成主窗口(root=tkinter.Tk()):root.title('标题名') 修改框体的名字,也可在创建时使用class ...
- 转:HDFS运行原理
简介 HDFS(Hadoop Distributed File System )Hadoop分布式文件系统.是根据google发表的论文翻版的.论文为GFS(Google File System)Go ...
- opencv:图像的基本变换
0.概述 图像变换的基本原理都是找到原图和目标图的像素位置的映射关系,这个可以用坐标系来思考,在opencv中, 图像的坐标系是从左上角开始(0,0),向右是x增加方向(cols),向下时y增加方向( ...
- Codeforces命令行工具
https://github.com/xalanq/cf-tool Codeforces Tool 是 Codeforces 的命令行界面的工具. 这玩意儿挺快.挺小.挺强大,还跨平台哦. 特点 提交 ...
- 移动端点击(click)事件延迟问题的产生与解决方法
http://blog.csdn.net/xjun0812/article/details/64919063 问题的发现 上班做项目的时候碰到一个移动端项目,其中有个小游戏,相当于天上掉馅饼,用户需要 ...
- 极简MarkDown教程(常用样式)
推荐编辑软件,NotePad++ & MarkDownViewer++(插件),以下内容为MarkDown格式,可自行放到编辑软件中查看,或在线查看 #### . 标题 > 用#+空格开 ...