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

7th
Jul 2016
bitsofinfo
@bitsofinfo
Jul 07 2016 02:06
@spencergibb any thoughts on an easy way to run this build w/ spring-cloud? https://github.com/Netflix/eureka/issues/812#issuecomment-230952801
Spencer Gibb
@spencergibb
Jul 07 2016 03:19
You could force that version in a local project in your pom.xml or build.gradle
David Welch
@dwelch2344
Jul 07 2016 03:35
qq: is there a way to get all named circuit breakers from hystrix?
Spencer Gibb
@spencergibb
Jul 07 2016 03:37
You could via the metrics, I think.
David Welch
@dwelch2344
Jul 07 2016 03:38
was looking into that. how do you get a handle on whatever service / repo / factory
just HystrixCommandMetrics.getInstances()?
Spencer Gibb
@spencergibb
Jul 07 2016 03:39
Not sure
Alexander Kalinovski
@akalinovski
Jul 07 2016 08:14
Hi, everyone! Re: scaling and load balancing the consumer within spring-cloud-stream - looking into spring-cloud-stream-binder-rabbit I found that it’s always created TopicExchange so there is no way to have a Direct exchange
That’s why it cannot be correctly scaled
Mark Corkery
@KramKroc
Jul 07 2016 08:28
Hi folks, I’ve an API-Gateway that uses both zuul for proxying calls for other micro services, but also RestTemplates for some routes that require manual transformation of data prior to invoking another microservice.
I’m able to use <service name>.ribbon.readTimeout to define readtimeouts for the zuul routes
but for those using RestTemplate, the <service name>.ribbon.readTimeout doesn’t make use of the readTimeout values
I’m sure I can create a project to demonstrate this but wondered if anyone had any thoughts on this behaviour?
Dave Syer
@dsyer
Jul 07 2016 08:31
@akalinovski all the Stream guys are away this week. I'm sure someone can help you work through it next week.
@KramKroc why would RestTemplate know anything about Ribbon configuration?
Mark Corkery
@KramKroc
Jul 07 2016 08:33
@dsyer I’m using RibbonClient to define behaviour, does it not get used by RestTemplate?
Basing this in part on the article by Biju Kunjummen here: http://www.java-allandsundry.com/2015/12/spring-cloud-rest-client-with-netflix_24.html
Dave Syer
@dsyer
Jul 07 2016 08:42
I didn't read the article. Ribbon does not (and never did) use RestTemplate.
The other way round is relevant
Maybe that's what you mean
Mark Corkery
@KramKroc
Jul 07 2016 08:43
Yes :D
Dave Syer
@dsyer
Jul 07 2016 08:43
I never looked into how the connect timeout gets used in that scenario
I think Ribon is only used as a load balancer in that case, not as a client
Mark Corkery
@KramKroc
Jul 07 2016 08:43
Or to put it another way @dsyer how do I set the equivalent timeouts for RestTemplate :/
Dave Syer
@dsyer
Jul 07 2016 08:43
So I can imagine the timeout is irrelevant
Mark Corkery
@KramKroc
Jul 07 2016 08:44
That’s what I’m finding
Dave Syer
@dsyer
Jul 07 2016 08:44
RestTemplate has a client layer underneath it
Mark Corkery
@KramKroc
Jul 07 2016 08:44
It load balances fine
Dave Syer
@dsyer
Jul 07 2016 08:44
The timeout would be client specific
Mark Corkery
@KramKroc
Jul 07 2016 08:44
but any timeouts are ignored
Can that client specific timeout be set via config?
Dave Syer
@dsyer
Jul 07 2016 08:46
There's nothing in Spring Boot that exposes config properties for RestTemplate clients
You have to be creating the RestTemplate as a @Bean.
So you can configure it with the native API there I guess
Mark Corkery
@KramKroc
Jul 07 2016 08:47
Yes
Dave Syer
@dsyer
Jul 07 2016 08:47
There's also a RestTemplateCustomizerabstraction in Spring Boot 1.4 (and a Builder)
Mark Corkery
@KramKroc
Jul 07 2016 08:47
Would switching to Feign give any other options here to configure the timeouts via config?
Dave Syer
@dsyer
Jul 07 2016 08:48
Feign doesn't have external properties
It's quite focused on Java APIs
Mark Corkery
@KramKroc
Jul 07 2016 08:51
Cheers @dsyer much appreciated as always
David Steiman
@xetys
Jul 07 2016 15:56

Hey....I wrote a meta-annotation for @FeignClient

@FeignClient
public @interface AuthorizedFeignClient {
    @AliasFor(annotation = FeignClient.class, attribute = "name")
    String name() default "";

    @AliasFor(annotation = FeignClient.class, attribute = "value")
    String value() default "";

    @AliasFor(annotation = FeignClient.class, attribute = "configuration")
    Class<?>[] configuration() default OAuth2InterceptedFeignConfiguration.class;

to be able to use

@AuthorizedFeignClient("app1")
public interface FooClient

instead of

@FeignClient(value = "app1", configuration = OAuth2InterceptedFeignConfiguration.class)
public interface FooClient
however, any attempt to make this work by overriding "value", fails....and only on this attribute
so @AuthorizedFeignClient(name = "app1") is working, while @AuthorizedFeignClient("app1") is not
any idea, how to workaround that?
Dave Syer
@dsyer
Jul 07 2016 16:02
I'm not sure.
To find out why it's not working as expected you'll hav eto dig into who is actually creating the annotation metadata from @FeignClient classes
Probably Spring
Probably it's in a BeanDefinition
David Steiman
@xetys
Jul 07 2016 16:04
i am not sure, but it should be FeignClientRegistrar, or am I wrong with that?
Dave Syer
@dsyer
Jul 07 2016 16:05
FeignClientRegistrar just reads the metadata IIRC
It gets passed in from somewhere else.
You can probably debug through that class to see the gorey details
Matt Benson
@mbenson
Jul 07 2016 16:24
you're probably looking for the SpringMvcContract
David Steiman
@xetys
Jul 07 2016 16:46
maybe
Dave Syer
@dsyer
Jul 07 2016 16:50
The contract doesn't know about @FeignClient so I don't think that's where you need to focus
@FeignClient is 100% Spring AFAIK
David Steiman
@xetys
Jul 07 2016 16:55
it is...
so i have to hook somehow into the contract, right?
Dave Syer
@dsyer
Jul 07 2016 16:58
The contract isn't getting the right data.
But the contract is not really relevant to your problem AFAIK
It's the thing that parses the @FeignClient annotation that gets it wrong, right?
David Steiman
@xetys
Jul 07 2016 17:01
i am not sure, i hadn't dig in springs annotation system so far
in debugger i looked at the FeignClientRegistrar
to look, which attributes actually arriving
David Steiman
@xetys
Jul 07 2016 17:15
found another really interesting behaviour....the way i defined the AuthorizedFeignClient has a side effect of wiring the OAuth2InterceptedFeignConfiguration into every feign client, even if annotated with just @FeignClient. I moved the OAuth2InterceptedFeignConfiguration into another package and put it with all its beans into excludeFilter from component scan.....and so far i mention it as default value for the custom meta-annotation, it is wired into every other feign client, too
what is going on?
Dave Syer
@dsyer
Jul 07 2016 17:15
Hmm. Dunno.
That seems wrong.
David Steiman
@xetys
Jul 07 2016 17:16
indeed
Dave Syer
@dsyer
Jul 07 2016 17:16
It's end of day here. I can probably look tomorrow.
David Steiman
@xetys
Jul 07 2016 17:17
I would drop you a github link with the application i am trying it on, if that is okay
Dave Syer
@dsyer
Jul 07 2016 17:22
Sure
David Steiman
@xetys
Jul 07 2016 17:28
thanks!
bitsofinfo
@bitsofinfo
Jul 07 2016 18:53
whats the primary difference between spring cloud bus vs stream?
just trying to grapple with what use-cases are more appropriate for each
Spencer Gibb
@spencergibb
Jul 07 2016 19:06
Bus is built on stream. Stream is God
Wow autocorrect
bitsofinfo
@bitsofinfo
Jul 07 2016 19:07
ha
Spencer Gibb
@spencergibb
Jul 07 2016 19:07
Stream is for app data, bus is for control plane messages like refresh or update your environment
bitsofinfo
@bitsofinfo
Jul 07 2016 19:07
k, so bus just builds some higher level abstractions letting you avoid having to know everything about stream
?
Spencer Gibb
@spencergibb
Jul 07 2016 19:08
Stream is analogous to spring MVC, bus to actuator
bitsofinfo
@bitsofinfo
Jul 07 2016 19:08
k
thanks
pradeepkusingh
@pradeepkusingh
Jul 07 2016 20:31
@spencergibb @dsyer : do we have any sample to use multiple repo in configserver ?
Dave Syer
@dsyer
Jul 07 2016 20:37
There are tests. And it's covered in the user guide.
I do t know what else you would need.
pradeepkusingh
@pradeepkusingh
Jul 07 2016 20:51
ok. let me check it.. i might have missed it.. Thanks Dave
pradeepkusingh
@pradeepkusingh
Jul 07 2016 21:03
got it. Thanks
JonathanAaron
@JonathanAaron
Jul 07 2016 21:28
Getting an error when triggering a refresh. https://gist.github.com/JonathanAaron/a1008f61e63ed92a5753ccee0ca24776 Does hitting the refresh endpoint cause a client to de-register with eureka?
bitsofinfo
@bitsofinfo
Jul 07 2016 21:48
I have an app w/ spring-data-rest generated endpoints, my build.gradle has compile 'org.springframework.cloud:spring-cloud-starter-sleuth', in my logs I'm getting traceid/spanids like this b49bfbae4810e823, 3f870b221b239a78. Expected? Is the http:/path prefixed stuff explained in the docs only if I am specifying the zipkin starter?
bitsofinfo
@bitsofinfo
Jul 07 2016 21:59
oh thats prob a meta-data label that only is visible if in zipkin, ids in logs...
bitsofinfo
@bitsofinfo
Jul 07 2016 22:26
again guys, figured it out, throughly impressed with your work on cloud!