com.alibaba.dubbo.config.MonitorConfig Java Examples

The following examples show how to use com.alibaba.dubbo.config.MonitorConfig. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: DubboBeanDefinitionParser.java    From dubbox with Apache License 2.0 6 votes vote down vote up
protected static MonitorConfig convertMonitor(String monitor) {
    if (monitor == null || monitor.length() == 0) {
        return null;
    }
    if (GROUP_AND_VERION.matcher(monitor).matches()) {
        String group;
        String version;
        int i = monitor.indexOf(':');
        if (i > 0) {
            group = monitor.substring(0, i);
            version = monitor.substring(i + 1);
        } else {
            group = monitor;
            version = null;
        }
        MonitorConfig monitorConfig = new MonitorConfig();
        monitorConfig.setGroup(group);
        monitorConfig.setVersion(version);
        return monitorConfig;
    }
    return null;
}
 
Example #2
Source File: DubboBeanDefinitionParser.java    From dubbox with Apache License 2.0 6 votes vote down vote up
protected static MonitorConfig convertMonitor(String monitor) {
    if (monitor == null || monitor.length() == 0) {
        return null;
    }
    if (GROUP_AND_VERION.matcher(monitor).matches()) {
        String group;
        String version;
        int i = monitor.indexOf(':');
        if (i > 0) {
            group = monitor.substring(0, i);
            version = monitor.substring(i + 1);
        } else {
            group = monitor;
            version = null;
        }
        MonitorConfig monitorConfig = new MonitorConfig();
        monitorConfig.setGroup(group);
        monitorConfig.setVersion(version);
        return monitorConfig;
    }
    return null;
}
 
Example #3
Source File: DubboBeanDefinitionParser.java    From dubbo3 with Apache License 2.0 6 votes vote down vote up
protected static MonitorConfig convertMonitor(String monitor) {
    if (monitor == null || monitor.length() == 0) {
        return null;
    }
    if (GROUP_AND_VERION.matcher(monitor).matches()) {
        String group;
        String version;
        int i = monitor.indexOf(':');
        if (i > 0) {
            group = monitor.substring(0, i);
            version = monitor.substring(i + 1);
        } else {
            group = monitor;
            version = null;
        }
        MonitorConfig monitorConfig = new MonitorConfig();
        monitorConfig.setGroup(group);
        monitorConfig.setVersion(version);
        return monitorConfig;
    }
    return null;
}
 
Example #4
Source File: DubboBeanDefinitionParser.java    From dubbox-hystrix with Apache License 2.0 6 votes vote down vote up
protected static MonitorConfig convertMonitor(String monitor) {
    if (monitor == null || monitor.length() == 0) {
        return null;
    }
    if (GROUP_AND_VERION.matcher(monitor).matches()) {
        String group;
        String version;
        int i = monitor.indexOf(':');
        if (i > 0) {
            group = monitor.substring(0, i);
            version = monitor.substring(i + 1);
        } else {
            group = monitor;
            version = null;
        }
        MonitorConfig monitorConfig = new MonitorConfig();
        monitorConfig.setGroup(group);
        monitorConfig.setVersion(version);
        return monitorConfig;
    }
    return null;
}
 
Example #5
Source File: DubboBeanDefinitionParser.java    From dubbox with Apache License 2.0 6 votes vote down vote up
protected static MonitorConfig convertMonitor(String monitor) {
    if (monitor == null || monitor.length() == 0) {
        return null;
    }
    if (GROUP_AND_VERION.matcher(monitor).matches()) {
        String group;
        String version;
        int i = monitor.indexOf(':');
        if (i > 0) {
            group = monitor.substring(0, i);
            version = monitor.substring(i + 1);
        } else {
            group = monitor;
            version = null;
        }
        MonitorConfig monitorConfig = new MonitorConfig();
        monitorConfig.setGroup(group);
        monitorConfig.setVersion(version);
        return monitorConfig;
    }
    return null;
}
 
Example #6
Source File: DubboNamespaceHandler.java    From dubbo-2.6.5 with Apache License 2.0 5 votes vote down vote up
@Override
    public void init() {
//        xml配置解析=》
        registerBeanDefinitionParser("application", new DubboBeanDefinitionParser(ApplicationConfig.class, true));
        registerBeanDefinitionParser("module", new DubboBeanDefinitionParser(ModuleConfig.class, true));
        registerBeanDefinitionParser("registry", new DubboBeanDefinitionParser(RegistryConfig.class, true));
        registerBeanDefinitionParser("monitor", new DubboBeanDefinitionParser(MonitorConfig.class, true));
        registerBeanDefinitionParser("provider", new DubboBeanDefinitionParser(ProviderConfig.class, true));
        registerBeanDefinitionParser("consumer", new DubboBeanDefinitionParser(ConsumerConfig.class, true));
        registerBeanDefinitionParser("protocol", new DubboBeanDefinitionParser(ProtocolConfig.class, true));
        registerBeanDefinitionParser("service", new DubboBeanDefinitionParser(ServiceBean.class, true));
        registerBeanDefinitionParser("reference", new DubboBeanDefinitionParser(ReferenceBean.class, false));
//        annotation解析<dubbo:annotation package="" />xml配置=》
        registerBeanDefinitionParser("annotation", new AnnotationBeanDefinitionParser());
    }
 
Example #7
Source File: DubboNamespaceHandler.java    From dubbox with Apache License 2.0 5 votes vote down vote up
public void init() {
 registerBeanDefinitionParser("application", new DubboBeanDefinitionParser(ApplicationConfig.class, true));
    registerBeanDefinitionParser("module", new DubboBeanDefinitionParser(ModuleConfig.class, true));
    registerBeanDefinitionParser("registry", new DubboBeanDefinitionParser(RegistryConfig.class, true));
    registerBeanDefinitionParser("monitor", new DubboBeanDefinitionParser(MonitorConfig.class, true));
    registerBeanDefinitionParser("provider", new DubboBeanDefinitionParser(ProviderConfig.class, true));
    registerBeanDefinitionParser("consumer", new DubboBeanDefinitionParser(ConsumerConfig.class, true));
    registerBeanDefinitionParser("protocol", new DubboBeanDefinitionParser(ProtocolConfig.class, true));
    registerBeanDefinitionParser("service", new DubboBeanDefinitionParser(ServiceBean.class, true));
    registerBeanDefinitionParser("reference", new DubboBeanDefinitionParser(ReferenceBean.class, false));
    registerBeanDefinitionParser("annotation", new DubboBeanDefinitionParser(AnnotationBean.class, true));
}
 
Example #8
Source File: DubboNamespaceHandler.java    From dubbox with Apache License 2.0 5 votes vote down vote up
public void init() {
 registerBeanDefinitionParser("application", new DubboBeanDefinitionParser(ApplicationConfig.class, true));
    registerBeanDefinitionParser("module", new DubboBeanDefinitionParser(ModuleConfig.class, true));
    registerBeanDefinitionParser("registry", new DubboBeanDefinitionParser(RegistryConfig.class, true));
    registerBeanDefinitionParser("monitor", new DubboBeanDefinitionParser(MonitorConfig.class, true));
    registerBeanDefinitionParser("provider", new DubboBeanDefinitionParser(ProviderConfig.class, true));
    registerBeanDefinitionParser("consumer", new DubboBeanDefinitionParser(ConsumerConfig.class, true));
    registerBeanDefinitionParser("protocol", new DubboBeanDefinitionParser(ProtocolConfig.class, true));
    registerBeanDefinitionParser("service", new DubboBeanDefinitionParser(ServiceBean.class, true));
    registerBeanDefinitionParser("reference", new DubboBeanDefinitionParser(ReferenceBean.class, false));
    registerBeanDefinitionParser("annotation", new DubboBeanDefinitionParser(AnnotationBean.class, true));
}
 
Example #9
Source File: DubboNamespaceHandler.java    From dubbo3 with Apache License 2.0 5 votes vote down vote up
public void init() {
 registerBeanDefinitionParser("application", new DubboBeanDefinitionParser(ApplicationConfig.class, true));
    registerBeanDefinitionParser("module", new DubboBeanDefinitionParser(ModuleConfig.class, true));
    registerBeanDefinitionParser("registry", new DubboBeanDefinitionParser(RegistryConfig.class, true));
    registerBeanDefinitionParser("monitor", new DubboBeanDefinitionParser(MonitorConfig.class, true));
    registerBeanDefinitionParser("provider", new DubboBeanDefinitionParser(ProviderConfig.class, true));
    registerBeanDefinitionParser("consumer", new DubboBeanDefinitionParser(ConsumerConfig.class, true));
    registerBeanDefinitionParser("protocol", new DubboBeanDefinitionParser(ProtocolConfig.class, true));
    registerBeanDefinitionParser("service", new DubboBeanDefinitionParser(ServiceBean.class, true));
    registerBeanDefinitionParser("reference", new DubboBeanDefinitionParser(ReferenceBean.class, false));
    registerBeanDefinitionParser("annotation", new DubboBeanDefinitionParser(AnnotationBean.class, true));
}
 
Example #10
Source File: DubboAutoConfiguration.java    From spring-boot-starter-dubbo with Apache License 2.0 5 votes vote down vote up
private void registerMonitor(MonitorConfig monitorConfig, ConfigurableListableBeanFactory beanFactory) {
	if (monitorConfig != null) {
		String beanName = monitorConfig.getId();
		if (StringUtils.isEmpty(beanName)) {
			beanName = "monitorConfig";
		}
		beanFactory.registerSingleton(beanName, monitorConfig);
	} else {
		logger.debug("dubbo 没有配置服务监控中心");
	}
}
 
Example #11
Source File: DubboAutoConfiguration.java    From spring-boot-starter-dubbo with Apache License 2.0 5 votes vote down vote up
@Override
public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException {
	DubboProperties dubboProperties = this.getPropertiesConfigurationBean(DubboProperties.targetName, DubboProperties.class);
	ApplicationConfig application = dubboProperties.getApplication();
	MonitorConfig monitor = dubboProperties.getMonitor();
	ModuleConfig module = dubboProperties.getModule();
	ProviderConfig provider = dubboProperties.getProvider();
	ConsumerConfig consumer = dubboProperties.getConsumer();
	List<ProtocolConfig> protocols = this.getProtocols(dubboProperties);
	List<RegistryConfig> registryConfigs = this.getRegistrys(dubboProperties);
	List<ReferenceConfig<?>> references = dubboProperties.getReferences();
	List<ServiceConfig<?>> services = dubboProperties.getServices();
	this.registerRegistry(registryConfigs, beanFactory);

	String basePackage = dubboProperties.getBasePackage();

	if (provider != null) {
		provider.setProtocols(this.getProtocol(protocols, "spring.dubbo.provider.protocol"));
		provider.setRegistries(this.getRegistry(registryConfigs, "spring.dubbo.provider.registry"));
	}

	if (consumer != null) {
		consumer.setRegistries(this.getRegistry(registryConfigs, "spring.dubbo.consumer.registry"));
	}

	this.registerThis(basePackage, beanFactory);
	this.registerApplication(application, beanFactory);
	this.registerProtocols(protocols, beanFactory);
	this.registerMonitor(monitor, beanFactory);
	this.registerModule(module, beanFactory);
	this.registerProvider(provider, beanFactory);
	this.registerConsumer(consumer, beanFactory);
	this.registerReferences(references, beanFactory);
	this.registerServices(services, beanFactory);
	super.postProcessBeanFactory(beanFactory);
	super.postProcessAnnotationPackageService();
}
 
Example #12
Source File: DubboNamespaceHandler.java    From dubbox-hystrix with Apache License 2.0 5 votes vote down vote up
public void init() {
 registerBeanDefinitionParser("application", new DubboBeanDefinitionParser(ApplicationConfig.class, true));
    registerBeanDefinitionParser("module", new DubboBeanDefinitionParser(ModuleConfig.class, true));
    registerBeanDefinitionParser("registry", new DubboBeanDefinitionParser(RegistryConfig.class, true));
    registerBeanDefinitionParser("monitor", new DubboBeanDefinitionParser(MonitorConfig.class, true));
    registerBeanDefinitionParser("provider", new DubboBeanDefinitionParser(ProviderConfig.class, true));
    registerBeanDefinitionParser("consumer", new DubboBeanDefinitionParser(ConsumerConfig.class, true));
    registerBeanDefinitionParser("protocol", new DubboBeanDefinitionParser(ProtocolConfig.class, true));
    registerBeanDefinitionParser("service", new DubboBeanDefinitionParser(ServiceBean.class, true));
    registerBeanDefinitionParser("reference", new DubboBeanDefinitionParser(ReferenceBean.class, false));
    registerBeanDefinitionParser("annotation", new DubboBeanDefinitionParser(AnnotationBean.class, true));
}
 
Example #13
Source File: DubboNamespaceHandler.java    From dubbox with Apache License 2.0 5 votes vote down vote up
public void init() {
 registerBeanDefinitionParser("application", new DubboBeanDefinitionParser(ApplicationConfig.class, true));
    registerBeanDefinitionParser("module", new DubboBeanDefinitionParser(ModuleConfig.class, true));
    registerBeanDefinitionParser("registry", new DubboBeanDefinitionParser(RegistryConfig.class, true));
    registerBeanDefinitionParser("monitor", new DubboBeanDefinitionParser(MonitorConfig.class, true));
    registerBeanDefinitionParser("provider", new DubboBeanDefinitionParser(ProviderConfig.class, true));
    registerBeanDefinitionParser("consumer", new DubboBeanDefinitionParser(ConsumerConfig.class, true));
    registerBeanDefinitionParser("protocol", new DubboBeanDefinitionParser(ProtocolConfig.class, true));
    registerBeanDefinitionParser("service", new DubboBeanDefinitionParser(ServiceBean.class, true));
    registerBeanDefinitionParser("reference", new DubboBeanDefinitionParser(ReferenceBean.class, false));
    registerBeanDefinitionParser("annotation", new DubboBeanDefinitionParser(AnnotationBean.class, true));
}
 
Example #14
Source File: DubboMonitorConsumerFactory.java    From EasyTransaction with Apache License 2.0 5 votes vote down vote up
public DubboMonitorConsumerFactory(Optional<ApplicationConfig> applicationConfig, Optional<RegistryConfig> registryConfig,Optional<ProtocolConfig> protocolConfig,Optional<ConsumerConfig> consumerConfig,Optional<ModuleConfig> moduleConfig,Optional<MonitorConfig> monitorConfig, Optional<DubboReferanceCustomizationer> customizationer) {
    super();
    this.applicationConfig = applicationConfig.orElse(null);
    this.registryConfig = registryConfig.orElse(null);
    this.protocolConfig = protocolConfig.orElse(null);
    this.customizationer = customizationer.orElse(null);
    this.consumerConfig = consumerConfig.orElse(null);
    this.moduleConfig = moduleConfig.orElse(null);
    this.monitorConfig = monitorConfig.orElse(null);
}
 
Example #15
Source File: EnableDubboConfigTest.java    From dubbo-2.6.5 with Apache License 2.0 5 votes vote down vote up
@Test
public void testSingle() {

    AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext();
    context.register(TestConfig.class);
    context.refresh();

    // application
    ApplicationConfig applicationConfig = context.getBean("applicationBean", ApplicationConfig.class);
    Assert.assertEquals("dubbo-demo-application", applicationConfig.getName());

    // module
    ModuleConfig moduleConfig = context.getBean("moduleBean", ModuleConfig.class);
    Assert.assertEquals("dubbo-demo-module", moduleConfig.getName());

    // registry
    RegistryConfig registryConfig = context.getBean(RegistryConfig.class);
    Assert.assertEquals("zookeeper://192.168.99.100:32770", registryConfig.getAddress());

    // protocol
    ProtocolConfig protocolConfig = context.getBean(ProtocolConfig.class);
    Assert.assertEquals("dubbo", protocolConfig.getName());
    Assert.assertEquals(Integer.valueOf(20880), protocolConfig.getPort());

    // monitor
    MonitorConfig monitorConfig = context.getBean(MonitorConfig.class);
    Assert.assertEquals("zookeeper://127.0.0.1:32770", monitorConfig.getAddress());

    // provider
    ProviderConfig providerConfig = context.getBean(ProviderConfig.class);
    Assert.assertEquals("127.0.0.1", providerConfig.getHost());


    // consumer
    ConsumerConfig consumerConfig = context.getBean(ConsumerConfig.class);
    Assert.assertEquals("netty", consumerConfig.getClient());

}
 
Example #16
Source File: DubboNamespaceHandlerTest.java    From dubbo-2.6.5 with Apache License 2.0 5 votes vote down vote up
@Test
public void testMonitor() {
    ClassPathXmlApplicationContext ctx = new ClassPathXmlApplicationContext(ConfigTest.class.getPackage().getName().replace('.', '/') + "/provider-with-monitor.xml");
    ctx.start();

    assertThat(ctx.getBean(MonitorConfig.class), not(nullValue()));
}
 
Example #17
Source File: DubboMonitorProvider.java    From EasyTransaction with Apache License 2.0 5 votes vote down vote up
public DubboMonitorProvider(String appId, EasyTransFilterChainFactory filterChainFactory, Optional<ApplicationConfig> applicationConfig,
        Optional<RegistryConfig> registryConfig,Optional<ProtocolConfig> protocolConfig,Optional<ProviderConfig> providerConfig,Optional<ModuleConfig> moduleConfig,Optional<MonitorConfig> monitorConfig, Optional<DubboServiceCustomizationer> customizationer,List<EtMonitor> etMonitorList) {
    super();
    this.appId = appId;
    this.applicationConfig = applicationConfig.orElse(null);
    this.registryConfig = registryConfig.orElse(null);
    this.protocolConfig = protocolConfig.orElse(null);
    this.providerConfig = providerConfig.orElse(null);
    this.moduleConfig = moduleConfig.orElse(null);
    this.monitorConfig = monitorConfig.orElse(null);
    this.customizationer = customizationer.orElse(null);
    this.etMonitorList = etMonitorList;
}
 
Example #18
Source File: DubboEasyTransRpcProviderImpl.java    From EasyTransaction with Apache License 2.0 5 votes vote down vote up
public DubboEasyTransRpcProviderImpl(EasyTransFilterChainFactory filterChainFactory, Optional<ApplicationConfig> applicationConfig,
		Optional<RegistryConfig> registryConfig,Optional<ProtocolConfig> protocolConfig,Optional<ProviderConfig> providerConfig,Optional<ModuleConfig> moduleConfig,Optional<MonitorConfig> monitorConfig, Optional<DubboServiceCustomizationer> customizationer) {
	super();
	this.filterChainFactory = filterChainFactory;
	this.applicationConfig = applicationConfig.orElse(null);
	this.registryConfig = registryConfig.orElse(null);
	this.protocolConfig = protocolConfig.orElse(null);
	this.providerConfig = providerConfig.orElse(null);
	this.moduleConfig = moduleConfig.orElse(null);
	this.monitorConfig = monitorConfig.orElse(null);
	this.customizationer = customizationer.orElse(null);
	injectHelper = this;
}
 
Example #19
Source File: DubboEasyTransRpcConsumerImpl.java    From EasyTransaction with Apache License 2.0 5 votes vote down vote up
public DubboEasyTransRpcConsumerImpl(Optional<ApplicationConfig> applicationConfig, Optional<RegistryConfig> registryConfig,Optional<ProtocolConfig> protocolConfig,Optional<ConsumerConfig> consumerConfig,Optional<ModuleConfig> moduleConfig,Optional<MonitorConfig> monitorConfig, Optional<DubboReferanceCustomizationer> customizationer) {
	super();
	this.applicationConfig = applicationConfig.orElse(null);
	this.registryConfig = registryConfig.orElse(null);
	this.protocolConfig = protocolConfig.orElse(null);
	this.customizationer = customizationer.orElse(null);
	this.consumerConfig = consumerConfig.orElse(null);
	this.moduleConfig = moduleConfig.orElse(null);
	this.monitorConfig = monitorConfig.orElse(null);
}
 
Example #20
Source File: DubboEasyTransRpcConfiguration.java    From EasyTransaction with Apache License 2.0 4 votes vote down vote up
@Bean
@ConditionalOnMissingBean(MonitorConsumerFactory.class)
   public MonitorConsumerFactory monitorConsumerFactory(Optional<ApplicationConfig> applicationConfig, Optional<RegistryConfig> registryConfig,Optional<ProtocolConfig> protocolConfig,Optional<ConsumerConfig> consumerConfig,Optional<ModuleConfig> moduleConfig,Optional<MonitorConfig> monitorConfig, Optional<DubboReferanceCustomizationer> customizationer) {
       return new DubboMonitorConsumerFactory(applicationConfig, registryConfig, protocolConfig, consumerConfig, moduleConfig, monitorConfig, customizationer);
   }
 
Example #21
Source File: DubboProperties.java    From spring-boot-starter-dubbo with Apache License 2.0 4 votes vote down vote up
public void setMonitor(MonitorConfig monitor) {
    this.monitor = monitor;
}
 
Example #22
Source File: DubboProperties.java    From spring-boot-starter-dubbo with Apache License 2.0 4 votes vote down vote up
public MonitorConfig getMonitor() {
    return monitor;
}
 
Example #23
Source File: DubboProperties.java    From dubbo-spring-boot-starter with Apache License 2.0 4 votes vote down vote up
public void setMonitors(Map<String, MonitorConfig> monitors) {
  this.monitors = monitors;
}
 
Example #24
Source File: DubboProperties.java    From dubbo-spring-boot-starter with Apache License 2.0 4 votes vote down vote up
public Map<String, MonitorConfig> getMonitors() {
  return this.monitors;
}
 
Example #25
Source File: DubboProperties.java    From dubbo-spring-boot-starter with Apache License 2.0 4 votes vote down vote up
public void setMonitor(MonitorConfig monitor) {
  this.monitor = monitor;
}
 
Example #26
Source File: DubboProperties.java    From dubbo-spring-boot-starter with Apache License 2.0 4 votes vote down vote up
public MonitorConfig getMonitor() {
  return this.monitor;
}
 
Example #27
Source File: DubboEasyTransRpcConfiguration.java    From EasyTransaction with Apache License 2.0 4 votes vote down vote up
@Bean
@ConditionalOnMissingBean(EasyTransRpcConsumer.class)
public DubboEasyTransRpcConsumerImpl dubboEasyTransRpcConsumerImpl(Optional<ApplicationConfig> applicationConfig, Optional<RegistryConfig> registryConfig,Optional<ProtocolConfig> protocolConfig,Optional<ConsumerConfig> consumerConfig,Optional<ModuleConfig> moduleConfig,Optional<MonitorConfig> monitorConfig, Optional<DubboReferanceCustomizationer> customizationer){
	return new DubboEasyTransRpcConsumerImpl(applicationConfig, registryConfig, protocolConfig, consumerConfig, moduleConfig, monitorConfig, customizationer);
}
 
Example #28
Source File: DubboEasyTransRpcConfiguration.java    From EasyTransaction with Apache License 2.0 4 votes vote down vote up
@Bean
@ConditionalOnMissingBean(EasyTransRpcProvider.class)
public DubboEasyTransRpcProviderImpl onsEasyTransMsgPublisherImpl(EasyTransFilterChainFactory filterChainFactory, Optional<ApplicationConfig> applicationConfig,
		Optional<RegistryConfig> registryConfig,Optional<ProtocolConfig> protocolConfig,Optional<ProviderConfig> providerConfig,Optional<ModuleConfig> moduleConfig,Optional<MonitorConfig> monitorConfig, Optional<DubboServiceCustomizationer> customizationer){
	return new DubboEasyTransRpcProviderImpl(filterChainFactory, applicationConfig, registryConfig, protocolConfig, providerConfig, moduleConfig, monitorConfig, customizationer);
}
 
Example #29
Source File: DubboProperties.java    From spring-boot-starter-dubbo with Apache License 2.0 4 votes vote down vote up
public void setMonitor(MonitorConfig monitor) {
	this.monitor = monitor;
}
 
Example #30
Source File: DubboProperties.java    From spring-boot-starter-dubbo with Apache License 2.0 4 votes vote down vote up
public MonitorConfig getMonitor() {
	return monitor;
}