All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.zodiac.autoconfigure.loadbalancer.ribbon.InternalRibbonClientAutoConfiguration Maven / Gradle / Ivy

There is a newer version: 1.6.8
Show newest version
package org.zodiac.autoconfigure.loadbalancer.ribbon;

import org.springframework.boot.SpringBootConfiguration;
import org.springframework.boot.autoconfigure.AutoConfigureAfter;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.context.annotation.Bean;
import org.zodiac.autoconfigure.bootstrap.breaker.routing.AppRoutingProperties;
import org.zodiac.autoconfigure.bootstrap.breaker.routing.AppRoutingServerAutoConfiguration;
import org.zodiac.autoconfigure.bootstrap.condition.ConditionalOnAppDiscoveryEnabled;
import org.zodiac.autoconfigure.bootstrap.condition.ConditionalOnBreakerRoutingEnabled;
import org.zodiac.autoconfigure.bootstrap.condition.ConditionalOnSpringCloudBootstrapDisabled;
import org.zodiac.autoconfigure.loadbalancer.ribbon.condition.ConditionalOnRibbonEnabled;
import org.zodiac.autoconfigure.loadbalancer.ribbon.condition.ConditionalOnRibbonRuleEnabled;
import org.zodiac.core.application.AppInstance;
import org.zodiac.core.bootstrap.breaker.routing.AbstractAppRouter;
import org.zodiac.core.bootstrap.breaker.routing.service.OrderedAppRoutingService;
import org.zodiac.core.bootstrap.discovery.AppDiscoveryClient;
import org.zodiac.loadbalancer.ribbon.RibbonPropertiesFactory;
import org.zodiac.loadbalancer.ribbon.config.InternalRibbonClientConfigurer;

import com.netflix.client.config.IClientConfig;
import com.netflix.loadbalancer.IRule;
import com.netflix.loadbalancer.Server;
import com.netflix.loadbalancer.ServerList;

@SpringBootConfiguration
@ConditionalOnRibbonEnabled
@ConditionalOnAppDiscoveryEnabled
@ConditionalOnRibbonRuleEnabled
@ConditionalOnSpringCloudBootstrapDisabled
@AutoConfigureAfter(value = {AppRoutingServerAutoConfiguration.class})
public class InternalRibbonClientAutoConfiguration extends InternalRibbonClientConfigurer {

    public InternalRibbonClientAutoConfiguration(AppRoutingProperties appRoutingProperties, PlatformRibbonClientProperties platformRibbonClientProperties,
        RibbonPropertiesFactory ribbonPropertiesFactory) {
        super(appRoutingProperties, platformRibbonClientProperties, ribbonPropertiesFactory);
    }

    @Bean
    @ConditionalOnMissingBean(value = {OrderedAppRoutingService.class})
    @Override
    protected ServerList ribbonServerList(AppDiscoveryClient appDiscoveryClient, IClientConfig config) {
        return super.ribbonServerList(appDiscoveryClient, config);
    }

    @Bean
    @ConditionalOnBreakerRoutingEnabled
    @Override
    protected IRule rule(IClientConfig config, AbstractAppRouter serviceRoutingRouter,
        AppDiscoveryClient appDiscoveryClient) {
        return super.rule(config, serviceRoutingRouter, appDiscoveryClient);
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy