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

12th
May 2016
Felipe Santos
@felipemsantos
May 12 2016 03:04
Congrats!!!
Koizumi85
@Koizumi85
May 12 2016 07:24
congratulations to the team. :)
theoptimiste
@theoptimiste
May 12 2016 08:19
how to exchange messages between microservices via AMQP rabbit mq
Marcin Grzejszczak
@marcingrzejszczak
May 12 2016 08:24
theoptimiste
@theoptimiste
May 12 2016 09:45
@marcingrzejszczak thank you :)
Koizumi85
@Koizumi85
May 12 2016 09:46
@marcingrzejszczak you should point to the RELEASE version of the docs (for marketing reasons ;) )
theoptimiste
@theoptimiste
May 12 2016 09:50
I followed a guide messaging with RabbitMQ, I just copy paste the code presented on this website https://spring.io/guides/gs/messaging-rabbitmq/ , but I receive this error I know why?
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'rabbitMessageApplication': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: org.springframework.context.annotation.AnnotationConfigApplicationContext com.example.RabbitMessageApplication.context; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [org.springframework.context.annotation.AnnotationConfigApplicationContext] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:334) ~[spring-beans-4.2.6.RELEASE.jar:4.2.6.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1214) ~[spring-beans-4.2.6.RELEASE.jar:4.2.6.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:543) ~[spring-beans-4.2.6.RELEASE.jar:4.2.6.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:482) ~[spring-beans-4.2.6.RELEASE.jar:4.2.6.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306) ~[spring-beans-4.2.6.RELEASE.jar:4.2.6.RELEASE]
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230) ~[spring-beans-4.2.6.RELEASE.jar:4.2.6.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302) ~[spring-beans-4.2.6.RELEASE.jar:4.2.6.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197) ~[spring-beans-4.2.6.RELEASE.jar:4.2.6.RELEASE]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:772) ~[spring-beans-4.2.6.RELEASE.jar:4.2.6.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:839) ~[spring-context-4.2.6.RELEASE.jar:4.2.6.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:538) ~[spring-context-4.2.6.RELEASE.jar:4.2.6.RELEASE]
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:118) ~[spring-boot-1.3.5.RELEASE.jar:1.3.5.RELEASE]
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:766) [spring-boot-1.3.5.RELEASE.jar:1.3.5.RELEASE]
at org.springframework.boot.SpringApplication.createAndRefreshContext(SpringApplication.java:361) [spring-boot-1.3.5.RELEASE.jar:1.3.5.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:307) [spring-boot-1.3.5.RELEASE.jar:1.3.5.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1191) [spring-boot-1.3.5.RELEASE.jar:1.3.5.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1180) [spring-boot-1.3.5.RELEASE.jar:1.3.5.RELEASE]
at com.example.RabbitMessageApplication.main(RabbitMessageApplication.java:67) [classes/:na]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_77]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_77]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_77]
at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_77]
at com.intellij.rt.execution.application.AppMain.main
Marcin Grzejszczak
@marcingrzejszczak
May 12 2016 10:21
@Koizumi85 argh! I was supposed to do that! THanks!
Marcin Grzejszczak
@marcingrzejszczak
May 12 2016 11:24
@theoptimiste we would need a sample of your code - can you publish it somewhere?
Looks like a bug to me
Actually it works for me.
How did you run it @theoptimiste ?
Andreas Evers
@andreasevers
May 12 2016 11:44
Hi, I’m using Ribbon with Eureka to select the right origin to route to using the RibbonLoadBalancerClient’s choose(serviceId).
Now I’m wondering if it is possible to use the autowired RestTemplate, but not do dns resolution with ribbon’s loadbalancers for one specific case (while all other cases still using loadbalancer.choose(serviceId)).
I’d like to use the autowired RestTemplate since things like sleuth are then automatically enabled.
Dave Syer
@dsyer
May 12 2016 12:06
You need a separate RestTemplate I think
You can create new @Beans that are not @LoadBalanced and inject those
theoptimiste
@theoptimiste
May 12 2016 12:07
@dsyer I create a jar package, I follow type this command java -jar target / gs-messaging-rabbitmq-0.1.0.jar in command prompt
Dave Syer
@dsyer
May 12 2016 12:07
Sleuth will enhance them, but Ribbon will not
@theoptimiste I don't think your code is the same as the "complete" sample in the guide then, because that works fine
Andreas Evers
@andreasevers
May 12 2016 12:09
Not sure if I’m following with the bean injection. Do you mean I should create a new RestTemplate bean with a simple instantiation of the RestTemplate inside, and just because the bean is of type RestTemplate, Sleuth will enhance it automatically?
Dave Syer
@dsyer
May 12 2016 12:09
Yes
That's how it works
Andreas Evers
@andreasevers
May 12 2016 12:09
wow cool :)
Dave Syer
@dsyer
May 12 2016 12:10
You have to be careful with the autowiring
If anyone is autowiring an unqualified RestTemplate anywhere in your app or libraries it uses it will blow up
Andreas Evers
@andreasevers
May 12 2016 12:12
So basically I’ll have a RestTemplate bean which is the default one, with Ribbon instantiated, and my own RestTemplate bean with a different name (e.g. directRestTemplate), both living in the same applicationContext and I can just choose by qualifier which bean I want to autowire where
Dave Syer
@dsyer
May 12 2016 12:13
Yes
The ribbon one is @LoadBalanced
Since Brixton you have to create that yourself as well
Andreas Evers
@andreasevers
May 12 2016 12:40
I’m a bit confused though, if my url that I pass to the RestTemplate is structured like this: http://ul2031.bi:8403/foo/bar shouldn’t the RestTemplate know this is already a specific origin (since even the port is supplied)?
Dave Syer
@dsyer
May 12 2016 12:47
That might be a way to implement a rest template that is sometimes load balanced and sometimes not
But it's not the way Spring Cloud works right now
Andreas Evers
@andreasevers
May 12 2016 12:49
Alright, was just confused as I remember seeing Josh do something like this in one of his talks. Must have been a different scenario.
Thanks for the feedback! And see you in Barcelona :)
Dave Syer
@dsyer
May 12 2016 12:53
CU
Donovan Muller
@donovanmuller
May 12 2016 13:13
FYI, http://projects.spring.io/spring-cloud/ has double <groupId> for Maven pom example: screenshot
Niklas Herder
@herder
May 12 2016 14:35
Hi, I have two Eureka servers in two AZ:s on AWS which configure themselves through DNS and bind to an available EIP. This procedure works fine, but the servers don't seem to think that they can reach each other. Under the unavailable-replicas row in the Eureka dasboard, it says the EIP address - could that be why it doesn't consider it available? They can reach eachother fine using the EIP address on the internal network in the VPC.
Niklas Herder
@herder
May 12 2016 14:47
This seems to be the cause that the servers don't expire leases, so I'd really like to have this fixed :)
David Welch
@dwelch2344
May 12 2016 18:39
Congrats on the release! Super stoked to upgrade
@spencergibb: we're not seeing patches come through our Zuul (backed by Consul) services. Saw a few issues opened on it, but no major resolutions. Would including a later apache http client version help? ideas?
Simon Spielmann
@maihacke
May 12 2016 19:30
Are there any plans to support jax-rs in spring-cloud, like what was done with resttemplate and feign (loadbalancing, metrics, ....)
Matt Benson
@mbenson
May 12 2016 20:20
AFAIK spring-boot supports jax-rs, with one spring-cloud caveat being that you can't run jersey v2.x alongside Eureka (because it has a hard dependency on Jersey v1.x). If you wanted Feign support for JAX-RS, it would probably be a matter of replacing the Contract bean. Not sure if Feign's default Contract handles JAX-RS OOTB, but somewhere I've seen it suggested that Feign supports JAX-RS.
Spencer Gibb
@spencergibb
May 12 2016 20:29
@maihacke jax-rs are server side annotations. I don’t even know what “supporting” those would look like. If you’re talking about a jax-rs client like jersey, we don’t currently have any plans.
I see there is a jax rs client, again no plans.
I wouldn’t be hard to do, there is a https://docs.oracle.com/javaee/7/api/javax/ws/rs/client/ClientRequestFilter.html where you can mutate the request. Looks similar to what I did here https://docs.oracle.com/javaee/7/api/javax/ws/rs/client/ClientRequestFilter.html
Dave Syer
@dsyer
May 12 2016 20:34
What about the native support in feign?
Spencer Gibb
@spencergibb
May 12 2016 20:35
yeah, you could plug that in, but it’s just annotation sugar. Doesn’t use a client.
Dave Syer
@dsyer
May 12 2016 20:41
I thought that was the question. OP hasn't clarified.
Spencer Gibb
@spencergibb
May 12 2016 20:42
I read, “like rest template & feign” ie plugging in the load balancer. You’re right, I’m just guessing without clarification.
Simon Spielmann
@maihacke
May 12 2016 20:43
@spencergibb my question was about jax-rs clients... Thanks for your answer.
David Welch
@dwelch2344
May 12 2016 20:56
Any idea on why PATCH requests aren't making it through Zuul? They end up hitting our microservices as GET
Spencer Gibb
@spencergibb
May 12 2016 20:57
IIRC, ribbon client has some trouble.
David Welch
@dwelch2344
May 12 2016 21:02
so the problem lies within Ribbon itself? Isn't ribbon just used for load balancing / resolving which service to hit?
Spencer Gibb
@spencergibb
May 12 2016 21:03
they have a client too.
I believe if you create a bean of HttpClientRibbonCommandFactory that should help.
David Welch
@dwelch2344
May 12 2016 21:04
ahhh gotcha
David Welch
@dwelch2344
May 12 2016 21:24
You are all that is man
thx
Spencer Gibb
@spencergibb
May 12 2016 21:24
NP. I’d say it should be the default in Camden.