Java Code Examples for org.springframework.cloud.client.serviceregistry.AutoServiceRegistrationProperties

The following examples show how to use org.springframework.cloud.client.serviceregistry.AutoServiceRegistrationProperties. These examples are extracted from open source projects. 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
public static void setCheck(NewService service,
		AutoServiceRegistrationProperties autoServiceRegistrationProperties,
		ConsulDiscoveryProperties properties, ApplicationContext context,
		HeartbeatProperties heartbeatProperties) {
	if (properties.isRegisterHealthCheck() && service.getCheck() == null) {
		Integer checkPort;
		if (shouldRegisterManagement(autoServiceRegistrationProperties, properties,
				context)) {
			checkPort = getManagementPort(properties, context);
		}
		else {
			checkPort = service.getPort();
		}
		Assert.notNull(checkPort, "checkPort may not be null");
		service.setCheck(createCheck(checkPort, heartbeatProperties, properties));
	}
}
 
Example 2
public static ConsulAutoRegistration managementRegistration(
		AutoServiceRegistrationProperties autoServiceRegistrationProperties,
		ConsulDiscoveryProperties properties, ApplicationContext context,
		List<ConsulManagementRegistrationCustomizer> managementRegistrationCustomizers,
		HeartbeatProperties heartbeatProperties) {
	NewService management = new NewService();
	management.setId(getManagementServiceId(properties, context));
	management.setAddress(properties.getHostname());
	management
			.setName(getManagementServiceName(properties, context.getEnvironment()));
	management.setPort(getManagementPort(properties, context));
	management.setTags(properties.getManagementTags());
	management.setEnableTagOverride(properties.getManagementEnableTagOverride());
	management.setMeta(properties.getManagementMetadata());
	if (properties.isRegisterHealthCheck()) {
		management.setCheck(createCheck(getManagementPort(properties, context),
				heartbeatProperties, properties));
	}
	ConsulAutoRegistration registration = new ConsulAutoRegistration(management,
			autoServiceRegistrationProperties, properties, context,
			heartbeatProperties, managementRegistrationCustomizers);
	managementCustomize(managementRegistrationCustomizers, registration);
	return registration;
}
 
Example 3
public SidecarConsulAutoRegistration(NewService service,
		AutoServiceRegistrationProperties autoServiceRegistrationProperties,
		ConsulDiscoveryProperties properties, ApplicationContext context,
		HeartbeatProperties heartbeatProperties,
		List<ConsulManagementRegistrationCustomizer> managementRegistrationCustomizers) {
	super(service, autoServiceRegistrationProperties, properties, context,
			heartbeatProperties, managementRegistrationCustomizers);
}
 
Example 4
@Bean
@ConditionalOnMissingBean(ConsulAutoRegistration.class)
public ConsulAutoRegistration consulAutoRegistration(
        final MetaDataExtender metaDataExtender,
        final AutoServiceRegistrationProperties autoServiceRegistrationProperties,
        final ConsulDiscoveryProperties consulDiscoveryProperties,
        final ApplicationContext applicationContext,
        final List<ConsulRegistrationCustomizer> consulRegistrationCustomizers,
        final List<ConsulManagementRegistrationCustomizer> managementRegistrationCustomizers,
        final HeartbeatProperties heartbeatProperties) {

    metaDataExtender.extendMetaData();
    return ConsulAutoRegistration.registration(
            autoServiceRegistrationProperties,
            consulDiscoveryProperties,
            applicationContext,
            consulRegistrationCustomizers,
            managementRegistrationCustomizers,
            heartbeatProperties);
}
 
Example 5
@Deprecated
public ConsulAutoRegistration(NewService service,
		AutoServiceRegistrationProperties autoServiceRegistrationProperties,
		ConsulDiscoveryProperties properties, ApplicationContext context,
		HeartbeatProperties heartbeatProperties) {
	this(service, autoServiceRegistrationProperties, properties, context,
			heartbeatProperties, Collections.emptyList());
}
 
Example 6
public ConsulAutoRegistration(NewService service,
		AutoServiceRegistrationProperties autoServiceRegistrationProperties,
		ConsulDiscoveryProperties properties, ApplicationContext context,
		HeartbeatProperties heartbeatProperties,
		List<ConsulManagementRegistrationCustomizer> managementRegistrationCustomizers) {
	super(service, properties);
	this.autoServiceRegistrationProperties = autoServiceRegistrationProperties;
	this.context = context;
	this.heartbeatProperties = heartbeatProperties;
	this.managementRegistrationCustomizers = managementRegistrationCustomizers;
}
 
Example 7
@Bean
@ConditionalOnBean(AutoServiceRegistrationProperties.class)
public ServiceCombAutoServiceRegistration serviceCombAutoServiceRegistration(
    ServiceCombServiceRegistry registry,
    AutoServiceRegistrationProperties autoServiceRegistrationProperties,
    ServiceCombRegistration registration) {
  return new ServiceCombAutoServiceRegistration(registry,
      autoServiceRegistrationProperties, registration);
}
 
Example 8
@Bean
public ConsulAutoRegistration consulRegistration(
		AutoServiceRegistrationProperties autoServiceRegistrationProperties,
		ConsulDiscoveryProperties properties, ApplicationContext applicationContext,
		ObjectProvider<List<ConsulRegistrationCustomizer>> registrationCustomizers,
		ObjectProvider<List<ConsulManagementRegistrationCustomizer>> managementRegistrationCustomizers,
		HeartbeatProperties heartbeatProperties,
		SidecarProperties sidecarProperties) {
	return SidecarConsulAutoRegistration.registration(
			autoServiceRegistrationProperties, properties, applicationContext,
			registrationCustomizers.getIfAvailable(),
			managementRegistrationCustomizers.getIfAvailable(), heartbeatProperties,
			sidecarProperties);
}
 
Example 9
@Bean
@ConditionalOnBean(AutoServiceRegistrationProperties.class)
public NacosRegistration nacosRegistration(
		NacosDiscoveryProperties nacosDiscoveryProperties,
		ApplicationContext context) {
	return new NacosRegistration(nacosDiscoveryProperties, context);
}
 
Example 10
@Bean
@ConditionalOnBean(AutoServiceRegistrationProperties.class)
public NacosAutoServiceRegistration nacosAutoServiceRegistration(
		NacosServiceRegistry registry,
		AutoServiceRegistrationProperties autoServiceRegistrationProperties,
		NacosRegistration registration) {
	return new NacosAutoServiceRegistration(registry,
			autoServiceRegistrationProperties, registration);
}
 
Example 11
public ZookeeperAutoServiceRegistration(ZookeeperServiceRegistry registry,
		ZookeeperRegistration registration, ZookeeperDiscoveryProperties properties,
		AutoServiceRegistrationProperties arProperties) {
	super(registry, arProperties);
	this.registration = registration;
	this.properties = properties;
	if (this.properties.getInstancePort() != null) {
		this.registration.setPort(this.properties.getInstancePort());
	}
}
 
Example 12
@Bean
@ConditionalOnBean(AutoServiceRegistrationProperties.class)
@ConditionalOnProperty(
		value = "spring.cloud.service-registry.auto-registration.enabled",
		matchIfMissing = true)
public EurekaAutoServiceRegistration eurekaAutoServiceRegistration(
		ApplicationContext context, EurekaServiceRegistry registry,
		EurekaRegistration registration) {
	return new EurekaAutoServiceRegistration(context, registry, registration);
}
 
Example 13
@Bean
@ConditionalOnBean(AutoServiceRegistrationProperties.class)
@ConditionalOnProperty(
		value = "spring.cloud.service-registry.auto-registration.enabled",
		matchIfMissing = true)
public EurekaRegistration eurekaRegistration(EurekaClient eurekaClient,
		CloudEurekaInstanceConfig instanceConfig,
		ApplicationInfoManager applicationInfoManager, @Autowired(
				required = false) ObjectProvider<HealthCheckHandler> healthCheckHandler) {
	return EurekaRegistration.builder(instanceConfig).with(applicationInfoManager)
			.with(eurekaClient).with(healthCheckHandler).build();
}
 
Example 14
@Bean
@org.springframework.cloud.context.config.annotation.RefreshScope
@ConditionalOnBean(AutoServiceRegistrationProperties.class)
@ConditionalOnProperty(
		value = "spring.cloud.service-registry.auto-registration.enabled",
		matchIfMissing = true)
public EurekaRegistration eurekaRegistration(EurekaClient eurekaClient,
		CloudEurekaInstanceConfig instanceConfig,
		ApplicationInfoManager applicationInfoManager, @Autowired(
				required = false) ObjectProvider<HealthCheckHandler> healthCheckHandler) {
	return EurekaRegistration.builder(instanceConfig).with(applicationInfoManager)
			.with(eurekaClient).with(healthCheckHandler).build();
}
 
Example 15
/**
 * @param autoServiceRegistrationProperties registration properties
 * @param properties discovery properties
 * @param context Spring application context
 * @return if the management service should be registered with the
 * {@link ServiceRegistry}
 */
public static boolean shouldRegisterManagement(
		AutoServiceRegistrationProperties autoServiceRegistrationProperties,
		ConsulDiscoveryProperties properties, ApplicationContext context) {
	return autoServiceRegistrationProperties.isRegisterManagement()
			&& getManagementPort(properties, context) != null
			&& ManagementServerPortUtils.isDifferent(context);
}
 
Example 16
public ConsulAutoServiceRegistration(ConsulServiceRegistry serviceRegistry,
		AutoServiceRegistrationProperties autoServiceRegistrationProperties,
		ConsulDiscoveryProperties properties, ConsulAutoRegistration registration) {
	super(serviceRegistry, autoServiceRegistrationProperties);
	this.properties = properties;
	this.registration = registration;
}
 
Example 17
@Bean
@ConditionalOnMissingBean
public ConsulAutoServiceRegistration consulAutoServiceRegistration(
		ConsulServiceRegistry registry,
		AutoServiceRegistrationProperties autoServiceRegistrationProperties,
		ConsulDiscoveryProperties properties,
		ConsulAutoRegistration consulRegistration) {
	return new ConsulAutoServiceRegistration(registry,
			autoServiceRegistrationProperties, properties, consulRegistration);
}
 
Example 18
@Bean
@ConditionalOnMissingBean
public ConsulAutoRegistration consulRegistration(
		AutoServiceRegistrationProperties autoServiceRegistrationProperties,
		ConsulDiscoveryProperties properties, ApplicationContext applicationContext,
		ObjectProvider<List<ConsulRegistrationCustomizer>> registrationCustomizers,
		ObjectProvider<List<ConsulManagementRegistrationCustomizer>> managementRegistrationCustomizers,
		HeartbeatProperties heartbeatProperties) {
	return ConsulAutoRegistration.registration(autoServiceRegistrationProperties,
			properties, applicationContext, registrationCustomizers.getIfAvailable(),
			managementRegistrationCustomizers.getIfAvailable(), heartbeatProperties);
}
 
Example 19
@Bean
public CustomAutoRegistration consulAutoServiceRegistration(
		ConsulServiceRegistry serviceRegistry,
		AutoServiceRegistrationProperties autoServiceRegistrationProperties,
		ConsulDiscoveryProperties properties,
		ConsulAutoRegistration registration) {
	return new CustomAutoRegistration(serviceRegistry,
			autoServiceRegistrationProperties, properties, registration);
}
 
Example 20
@Autowired
public CustomAutoRegistration(ConsulServiceRegistry serviceRegistry,
		AutoServiceRegistrationProperties autoServiceRegistrationProperties,
		ConsulDiscoveryProperties properties,
		ConsulAutoRegistration registration) {
	super(serviceRegistry, autoServiceRegistrationProperties, properties,
			registration);
}
 
Example 21
public ServiceCombAutoServiceRegistration(ServiceCombServiceRegistry registry,
    AutoServiceRegistrationProperties autoServiceRegistrationProperties, ServiceCombRegistration registration) {
  super(registry, autoServiceRegistrationProperties);
  this.serviceCombRegistration = registration;
}
 
Example 22
@Bean
@ConditionalOnBean(AutoServiceRegistrationProperties.class)
public ServiceCombRegistration serviceCombRegistration(
    ServiceCombDiscoveryProperties serviceCombDiscoveryProperties) {
  return new ServiceCombRegistration(serviceCombDiscoveryProperties);
}
 
Example 23
Source Project: Moss   Source File: MossNacosAutoServiceRegistration.java    License: Apache License 2.0 4 votes vote down vote up
public MossNacosAutoServiceRegistration(ServiceRegistry<NacosRegistration> serviceRegistry,
                                        AutoServiceRegistrationProperties autoServiceRegistrationProperties, NacosRegistration registration, NacosRegistration registration1) {
    super(serviceRegistry, autoServiceRegistrationProperties, registration);
    this.registration = registration1;
}
 
Example 24
public NacosAutoServiceRegistration(ServiceRegistry<Registration> serviceRegistry,
		AutoServiceRegistrationProperties autoServiceRegistrationProperties,
		NacosRegistration registration) {
	super(serviceRegistry, autoServiceRegistrationProperties);
	this.registration = registration;
}