These are chat archives for spring-cloud/spring-cloud

20th
Sep 2016
Kaleb Scholes
@kalebscholes
Sep 20 2016 00:01
Is there a way to propagate errors using feign/hystrix? I see from the docs that vanilla hystrix allows you to pass in a Throwable parameter on the fallback method but my attempts at getting that to work through Feign have been futile.. Any ideas?
ccit-spence
@ccit-spence
Sep 20 2016 01:02
@spencergibb @dsyer I did finally get it working. It is pretty cool actually.
Zhou Tao
@iamzhout
Sep 20 2016 08:13
I have a question, that spring-cloud-sleuth-stream-1.0.0.RELEASE.jar and spring-cloud-zipkin-stream-1.0.0.RELEASE.jar is 1.8 bytecode compatible,
while in it's pom.xml, the target code should be 1.7, why the fact that the jar downloaded from maven center repository is 1.8?
Dave Syer
@dsyer
Sep 20 2016 08:16
Could be a bug. But 1.0.0 is old now. So you should be using 1.0.8 probably.
1.0.x does not build from master
Zhou Tao
@iamzhout
Sep 20 2016 08:25
OK, I have checked that 1.0.8's jar is in jdk1.7 compitable, I will use that version, thanks.
David Steiman
@xetys
Sep 20 2016 10:08

hey, I got some special problem with a loadbalanced RestTemplate, which is called during autoconfiguration. A cloud application is fetching JWT public key from a auth application, which is discoverable using eureka. The problem is, when this happens "to early", the loadbalancer fails with "no instaces of XXX available"...

if I add some more dependencies like hazelcast, synchronous liquibase or just a retryer on discovery client (dirty hard code stuff), than it works....I tried things like @ConditionalOnBean("discoveryClient") or same with "loadBalancerClient", also with ConditionalOnClass...but this seems to be generally the wrong direction because it's not about beans wired, but services fetched....is there any clean approach to ask for token keys after discovery client wired AND fetched some services?

Dave Syer
@dsyer
Sep 20 2016 10:25
I didn't really follow that bit about hazelcast and liquibase
David Steiman
@xetys
Sep 20 2016 10:25
this are configuration, slowing down the ovewrall bootup, so service discovery managed ist to have the auth instance before the security config asks for token
this could be done by whatever
but is defenitly no clean way
Dave Syer
@dsyer
Sep 20 2016 10:27
I guess you need to create a custom ResourceServerTokenServices and defer/retry the key lookup
You must be customizing that already
because the default in Spring Boot doesn't know about service discovery
David Steiman
@xetys
Sep 20 2016 10:39
Or maybe it is but that good idea to retrieve a token key on the fly
David Steiman
@xetys
Sep 20 2016 10:51
But = not
But at all, no, i am not configuring the token services. I have got a jwtAccessTokenEnhancer bean, what uses a load balanced rest template to fetch the public key for token signing
And if this is called to early, I got that failure
Dave Syer
@dsyer
Sep 20 2016 12:02
If you create your own JwtAccessTokenConverter then surely you control when and how often it fetches the key?
Ryan Baxter
@ryanjbaxter
Sep 20 2016 13:22
@dwelch2344 did u get an answer to your Hystrix question? Sorry I was out on vaca
David Welch
@dwelch2344
Sep 20 2016 13:24
Hah no worries, hope it was a good vaca ;)
I've asked a few. Which one 😂
(Just waking up. Trying to recall. I know there one outstanding)
Ryan Baxter
@ryanjbaxter
Sep 20 2016 13:25
hystix commands with the same key being overriden
@pradeepkusingh let me know if you still need help with the retry logic
this was a recent contribution, initially switching from symmetric key signing to RSA signing, but also fetching the public key when application starts up
for a lot of JHipster devs this now makes trouble, if they remove a lot options, like Hazelcast, so this bean wiring is reached before the "uaa" client is registered and visible to that application...then it fails with error msg "no instances of UAA are available"
I am looking for a better way to solve this
Ragnar Rova
@rrva
Sep 20 2016 15:50
Any advice when venturing into client-side load balancing land using DiscoveryClient ?
Spencer Gibb
@spencergibb
Sep 20 2016 16:04
Ragnar Rova
@rrva
Sep 20 2016 16:06
Experimenting if getting rid of ha-proxy (and some firewalls) can simplify some inter-microservice HTTP traffic by looking up service endpoints in consul
Docs say that @LoadBalanced implies using ribbon? So https://github.com/Netflix/ribbon ?
Spencer Gibb
@spencergibb
Sep 20 2016 16:07
RestTemplate can be automatically configured to use ribbon
yes
Ragnar Rova
@rrva
Sep 20 2016 16:08
I was not around, but ribbon gave some performance/latency problems in periods of waking up from low traffic
so ribbon is no longer in use here.
Spencer Gibb
@spencergibb
Sep 20 2016 16:09
Then spring cloud won’t be much help, because the loadbalancing is based on ribbon
Ragnar Rova
@rrva
Sep 20 2016 16:10
At least DiscoveryClient is nice
pradeepkusingh
@pradeepkusingh
Sep 20 2016 16:12
@spencergibb : How to disable zuul filters ?
Spencer Gibb
@spencergibb
Sep 20 2016 16:14
zuul.<ClassSimpleName>.<filterType>.disable=true
pradeepkusingh
@pradeepkusingh
Sep 20 2016 16:14
Thanks :)
Spencer Gibb
@spencergibb
Sep 20 2016 16:14
for foo.MyFilter that is a pre filter zuul.MyFilter.pre.disable=true.
pradeepkusingh
@pradeepkusingh
Sep 20 2016 16:15
so no need to provide whole package .. just filter calls and type ?
class
Spencer Gibb
@spencergibb
Sep 20 2016 16:16
just like my example, no package
pradeepkusingh
@pradeepkusingh
Sep 20 2016 16:16
Thanks..:)
pradeepkusingh
@pradeepkusingh
Sep 20 2016 16:37
@ryanjbaxter : yes , I am seeing retry not working for post somehow. Do we need to do anything special to make it working ?
Ryan Baxter
@ryanjbaxter
Sep 20 2016 17:04
by default ribbon will not retry anything but GET requests
how are you making the request
is it going through zuul
are you using Feign?
pradeepkusingh
@pradeepkusingh
Sep 20 2016 17:41
yes. .. Zull+ribbon
no feign
I don't have any get method...:)
Ryan Baxter
@ryanjbaxter
Sep 20 2016 17:42
so does that mean the POST is going through Zuul to a service or is there another request after it goes through Zuul?
pradeepkusingh
@pradeepkusingh
Sep 20 2016 17:43
Client is posting request to Zuul and Ribbon+Eureka ---> Business micro services.
Ryan Baxter
@ryanjbaxter
Sep 20 2016 17:44
so the request goes from Client -> Zuul -> service
pradeepkusingh
@pradeepkusingh
Sep 20 2016 17:44
yes
Ryan Baxter
@ryanjbaxter
Sep 20 2016 17:44
or is it more like Client -> Zuul -> service -> service?
pradeepkusingh
@pradeepkusingh
Sep 20 2016 17:45
nope jsut client ---zuul ---service
Ryan Baxter
@ryanjbaxter
Sep 20 2016 17:46
ok
is this in Brixton?
pradeepkusingh
@pradeepkusingh
Sep 20 2016 17:57
yes
RC5
Ryan Baxter
@ryanjbaxter
Sep 20 2016 18:09
ok
so Zuul will not retry anything but GET requests by default
and the error that occurs when making the request needs to be a timeout
you can have all http methods retry by setting ribbon.OkToRetryOnAllOperations=true
however if the error that is occuring during the POST is not a timeout Zuul/Ribbon wont retry it anyways
read through the information I posted here and it might make more sense https://github.com/spring-cloud/spring-cloud-netflix/issues/1290#issuecomment-246707450
pradeepkusingh
@pradeepkusingh
Sep 20 2016 18:12
got it..may be I was expecting too much from it.. I thought it would retry for 404/500/503.. let me read yor notes. Thanks for help.
In Brixton, we use the Ribbon RestClient to proxy requests. By default the Ribbon RestClient will only retry any operation. Does this mean Post also ?
Ryan Baxter
@ryanjbaxter
Sep 20 2016 18:17
sorry that should say “an operation"
if u want to try to support retrying on those types of responses take a look at the sample here https://github.com/ryanjbaxter/zuul-retryer
that will retry when a 500 is returned for example
pradeepkusingh
@pradeepkusingh
Sep 20 2016 18:25
ok, Thanks
pradeepkusingh
@pradeepkusingh
Sep 20 2016 18:39
@ryanjbaxter Thank you.. it is very helpful. :)
pradeepkusingh
@pradeepkusingh
Sep 20 2016 19:52
@dsyer , @spencergibb one qq.... we are seeing someone is keep hitting our config server and causing lot of connections to github. We know app name as we can see in config server, but don't know the source. Is there a way to tell config server to reject some app request ?
Spencer Gibb
@spencergibb
Sep 20 2016 19:53
no, just normal spring security.
pradeepkusingh
@pradeepkusingh
Sep 20 2016 19:53
ok, Thank you :)
Marcos Barbero
@marcosbarbero
Sep 20 2016 19:54
@pradeepkusingh maybe it’s caused by the health check behaviour
pradeepkusingh
@pradeepkusingh
Sep 20 2016 19:58
ok, Let me check that also. Thanks .
David Welch
@dwelch2344
Sep 20 2016 21:17
@ryanjbaxter delayed response. I think we got that one resolved due to something on our end. thanks for following up : )
David Welch
@dwelch2344
Sep 20 2016 21:49
So, when using feign + hystrix: is there a good / preferred way of passing the actual error message upstream? Right now we've got a @ControllerAdvice error handler that takes exception messages and returns a JSON object with a friendly message, so we're contemplating just checking for a HystrixRuntimeException and unwrapping as necessary. Thoughts?
David Welch
@dwelch2344
Sep 20 2016 23:07
Another question regarding @RefreshScope – the docs mention changing a datasource and waiting for connections to drain. I have never seen a spring app recover gracefully from any sort of DB source issue. I.e. if the data source restarts, the service has to. In toying with refresh scope, the same rule has applied if I change the DB connection details
Ryan Baxter
@ryanjbaxter
Sep 20 2016 23:57
@dwelch2344 I think this feature might help with your error handling scenario OpenFeign/feign#443