Spring Cloud builds on Spring Boot...
oh , but i suppose the
programmers should be up all night
Client
to do some response manipulation. Trying this approach in a custom Feign @Configuration
annotated class. Problem is that the client I need to be proxying is the ribbon LoadBalancerClient and not this default one. How can I do that? (continuation of this convo: https://gitter.im/OpenFeign/feign?at=57b67582b64a3a016f4a8e99) @Bean
@Primary
public Client myClient() {
return new Client() {
private Client client = new Client.Default(null, null);
@Override
public Response execute(Request request, Options options) throws IOException {
Response resp = client.execute(request, options);
/*
* Impl all the custom mutations I want here
*
*/
return resp;
}
};
}
@Bean
@Primary
@Scope("prototype")
@ConditionalOnProperty(name = "feign.hystrix.enabled", matchIfMissing = true)
public Feign.Builder feignBuilder() {
return HystrixFeign.builder().client(myClient());
}
@Bean
public Client configurableLBFeignClient(CachingSpringLoadBalancerFactory cachingFactory,
SpringClientFactory clientFactory) {
return new LoadBalancerFeignClient(myClientBean(),
cachingFactory, clientFactory);
}
@hystrixcommand
with threadlocal
JGitEnvironmentRepository
and see how its handles a diverged remote repository.
spring.cloud.config.server.git.cloneOnStart=true
seems to fix my problem.
It looks like it tries to merge the Config Server HEAD with remote branch upon checkout.
The local repo of the config server ends up with conflicts like this :
<<<<<<< HEAD
flyway.enabled=false
flyway.baseline-version=0.5.0
=======
flyway.enabled=true
flyway.baseline-version=0.4.0
>>>>>>> branch 'int' of ....
@spencergibb What would think if I contribute an enhancement where the local repo is hard reset when the upstream diverge ?
JGitEnvironmentRepository
.
reset --hard
rather than pull
. Config Server should not ever modify remote configuration.
Anyone every experience this? I am seeing the FIRST call of a spring-cloud feign/hystrix/ribbon client trip the fallback, despite the response being sent back (i.e. a 200)
See the log snippet below (first line then second to last line)
All subsequent invocations work fine as expected.
2016-08-19 09:55:33,539 me app [t=44451130823f7b18,s=16dae6676b681f57,se=true] DEBUG [CountryClient] [CountryClient#getCountries] ---> GET http://zz-X-ee-service/dimCountries?size=1000 HTTP/1.1
2016-08-19 09:55:33,543 me app [t=44451130823f7b18,s=16dae6676b681f57,se=true] INFO [AnnotationConfigApplicationContext] Refreshing org.springframework.context.annotation.AnnotationConfigApplicationContext@3d7605dd: startup date [Fri Aug 19 09:55:33 MDT 2016]; parent: org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@5f254608
2016-08-19 09:55:33,576 me app [t=44451130823f7b18,s=16dae6676b681f57,se=true] INFO [AutowiredAnnotationBeanPostProcessor] JSR-330 'javax.inject.Inject' annotation found and supported for autowiring
2016-08-19 09:55:33,710 me app [t=44451130823f7b18,s=16dae6676b681f57,se=true] INFO [ChainedDynamicProperty] Flipping property: zz-X-ee-service.ribbon.ActiveConnectionsLimit to use NEXT property: niws.loadbalancer.availabilityFilteringRule.activeConnectionsLimit = 2147483647
2016-08-19 09:55:33,746 me app [t=44451130823f7b18,s=16dae6676b681f57,se=true] INFO [ShutdownEnabledTimer] Shutdown hook installed for: NFLoadBalancer-PingTimer-zz-X-ee-service
2016-08-19 09:55:33,771 me app [t=44451130823f7b18,s=16dae6676b681f57,se=true] INFO [BaseLoadBalancer] Client:zz-X-ee-service instantiated a LoadBalancer:DynamicServerListLoadBalancer:{NFLoadBalancer:name=zz-X-ee-service,current list of Servers=[],Load balancer stats=Zone stats: {},Server stats: []}ServerList:null
2016-08-19 09:55:33,775 me app [t=44451130823f7b18,s=16dae6676b681f57,se=true] INFO [DynamicServerListLoadBalancer] Using serverListUpdater PollingServerListUpdater
2016-08-19 09:55:33,794 me app [t=44451130823f7b18,s=16dae6676b681f57,se=true] INFO [ChainedDynamicProperty] Flipping property: zz-X-ee-service.ribbon.ActiveConnectionsLimit to use NEXT property: niws.loadbalancer.availabilityFilteringRule.activeConnectionsLimit = 2147483647
2016-08-19 09:55:33,795 me app [t=44451130823f7b18,s=16dae6676b681f57,se=true] INFO [DynamicServerListLoadBalancer] DynamicServerListLoadBalancer for client zz-X-ee-service initialized: DynamicServerListLoadBalancer:{NFLoadBalancer:name=zz-X-ee-service,current list of Servers=[192.168.0.208:8081],Load balancer stats=Zone stats: {defaultzone=[Zone:defaultzone; Instance count:1; Active connections count: 0; Circuit breaker tripped count: 0; Active connections per server: 0.0;]
},Server stats: [[Server:192.168.0.208:8081; Zone:defaultZone; Total Requests:0; Successive connection failure:0; Total blackout seconds:0; Last connection made:Wed Dec 31 17:00:00 MST 1969; First connection made: Wed Dec 31 17:00:00 MST 1969; Active Connections:0; total failure count in last (1000) msecs:0; average resp time:0.0; 90 percentile resp time:0.0; 95 percentile resp time:0.0; min resp time:0.0; max resp time:0.0; stddev resp time:0.0]
]}ServerList:org.springframework.cloud.netflix.ribbon.eureka.DomainExtractingServerList@33946948
2016-08-19 09:55:34,480 me app [t=44451130823f7b18,s=34b8173bab92975e,se=true] WARN [DoNothingCountryClientFallback] FALLBACK Invoked: getCountries()
2016-08-19 09:55:34,749 me app [t=44451130823f7b18,s=16dae6676b681f57,se=true] DEBUG [CountryClient] [CountryClient#getCountries] <--- HTTP/1.1 200 (1209ms)
2016-08-19 09:55:34,779 me app [t=,s=,se=] INFO [ChainedDynamicProperty] Flipping property: zz-X-ee-service.ribbon.ActiveConnectionsLimit to use NEXT property: niws.loadbalancer.availabilityFilteringRule.activeConnectionsLimit = 2147483647