org.springframework.cloud.netflix.zuul.filters.RefreshableRouteLocator Java Examples

The following examples show how to use org.springframework.cloud.netflix.zuul.filters.RefreshableRouteLocator. 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: DiscoveryClientConfig.java    From api-layer with Eclipse Public License 2.0 6 votes vote down vote up
@Bean(destroyMethod = "shutdown")
@RefreshScope
public ApimlDiscoveryClient eurekaClient(ApplicationInfoManager manager,
                                         EurekaClientConfig config,
                                         EurekaInstanceConfig instance,
                                         @Autowired(required = false) HealthCheckHandler healthCheckHandler
) {
    ApplicationInfoManager appManager;
    if (AopUtils.isAopProxy(manager)) {
        appManager = ProxyUtils.getTargetObject(manager);
    } else {
        appManager = manager;
    }
    final ApimlDiscoveryClient discoveryClientClient = new ApimlDiscoveryClient(appManager, config, this.optionalArgs, this.context);
    discoveryClientClient.registerHealthCheck(healthCheckHandler);

    discoveryClientClient.registerEventListener(event -> {
        if (event instanceof CacheRefreshedEvent) {
            refreshableRouteLocators.forEach(RefreshableRouteLocator::refresh);
            zuulHandlerMapping.setDirty(true);
        }
    });
    return discoveryClientClient;
}
 
Example #2
Source File: DiscoveryClientTestConfig.java    From api-layer with Eclipse Public License 2.0 6 votes vote down vote up
@Bean(destroyMethod = "shutdown")
@RefreshScope
public ApimlDiscoveryClientStub eurekaClient(ApplicationInfoManager manager,
                                             EurekaClientConfig config,
                                             EurekaInstanceConfig instance,
                                             @Autowired(required = false) HealthCheckHandler healthCheckHandler,
                                             ApplicationRegistry applicationRegistry
) {
    ApplicationInfoManager appManager;
    if (AopUtils.isAopProxy(manager)) {
        appManager = ProxyUtils.getTargetObject(manager);
    } else {
        appManager = manager;
    }

    final ApimlDiscoveryClientStub discoveryClient = new ApimlDiscoveryClientStub(appManager, config, this.optionalArgs, this.context, applicationRegistry);
    discoveryClient.registerHealthCheck(healthCheckHandler);

    discoveryClient.registerEventListener(event -> {
        if (event instanceof CacheRefreshedEvent) {
            refreshableRouteLocators.forEach(RefreshableRouteLocator::refresh);
            zuulHandlerMapping.setDirty(true);
        }
    });
    return discoveryClient;
}