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

31st
Mar 2016
Brad Gawne
@bgawne
Mar 31 2016 00:56
Hi, wondering what the right version of spring-cloud is to use with a spring-boot application. I'm using the latest release version of spring boot 1.3.3, but when i try to use Angel.SR6 is throws exceptions.
Tommy Ludwig
@shakuzen
Mar 31 2016 00:57
Spring Boot 1.3.x is compatible with the Spring Cloud Brixton release train (latest milestone is RC1)
Brad Gawne
@bgawne
Mar 31 2016 00:58
hmmm, tried that and i cant get it to run, throwing exceptions.........very odd
Spencer Gibb
@spencergibb
Mar 31 2016 01:02
@bgawne: @shakuzen is correct, boot 1.3.x needs Brixton
Brad Gawne
@bgawne
Mar 31 2016 01:05
thx guys, trying it now
getting this error when trying to startup (cant initalize discoveryclient):
Caused by: java.lang.NoSuchMethodError: com.thoughtworks.xstream.io.xml.DomDriver.<init>(Ljava/lang/String;Lcom/thoughtworks/xstream/io/naming/NameCoder;)V
at com.netflix.discovery.converters.XmlXStream.<init>(XmlXStream.java:45)
at com.netflix.discovery.converters.XmlXStream.<clinit>(XmlXStream.java:42)
at com.netflix.discovery.converters.wrappers.CodecWrappers$XStreamXml.<init>(CodecWrappers.java:358)
at com.netflix.discovery.converters.wrappers.CodecWrappers.create(CodecWrappers.java:133)
at com.netflix.discovery.converters.wrappers.CodecWrappers.getEncoder(CodecWrappers.java:75)
at com.netflix.discovery.converters.wrappers.CodecWrappers.getEncoder(CodecWrappers.java:66)
at com.netflix.discovery.provider.DiscoveryJerseyProvider.<init>(DiscoveryJerseyProvider.java:77)
not sure if there is a conflict with Spring-Boot X-Stream and Brixton dependancies?
Spencer Gibb
@spencergibb
Mar 31 2016 01:08
Missing some dependency? What does your pom.xml (or build.gradle) say?
Brad Gawne
@bgawne
Mar 31 2016 01:09
i can paste, 1 sec
This message was deleted
hmmm, thats not such a nice paste
is there a way to upload the pom file?
Tommy Ludwig
@shakuzen
Mar 31 2016 01:11
Could make a Gist (https://gist.github.com)
Brad Gawne
@bgawne
Mar 31 2016 01:13
awesome idea :)
Brad Gawne
@bgawne
Mar 31 2016 01:21
any ideas sincerly appreciated
Brad Gawne
@bgawne
Mar 31 2016 01:35
very odd, so i removed spring boot altogether and it still cant start the discovery client. goiing to try and create a shell version of the app
Brad Gawne
@bgawne
Mar 31 2016 01:48
defintely something in dependancies......when i create a skelton spring boot app with that pom file it wont startup, exact same error
Brad Gawne
@bgawne
Mar 31 2016 02:40
FYI....issue solved, it was a depency ordering in my POM file...by moving some dependencies to the bottom of the pom, it started working.
Mauro Monti
@mmonti
Mar 31 2016 06:39

Hi guys, I have a quick question. I am doing some test with Spring Consul Discovery, I have a simple endpoint returning a POJO and when I make a request to that endpoint I am getting:

{
  "timestamp": 1459402853920,
  "status": 406,
  "error": "Not Acceptable",
  "exception": "org.springframework.web.HttpMediaTypeNotAcceptableException",
  "message": "Could not find acceptable representation",
  "path": "/identity/user@email.com"
}

Now, if I remove the dependency from the POM file:

<dependency>
    <groupId>org.springframework.cloud</groupId>
    <artifactId>spring-cloud-starter-consul-discovery</artifactId>
</dependency>

I get the expected JSON. I am thinking the discovery dependency is re-configuring the converters but I am not sure were to look. I checked ConsulAutoConfiguration.java, RibbonConsulAutoConfiguration.java but I don't see anything obvious. It looks like this is a bug.
Any ideas?

Jose Armesto
@fiunchinho
Mar 31 2016 10:06

If my API that return JSON serialized responses has 3 endpoints

  • /users -> list of users serialized as JSON
  • /users/{user_id} -> returns user serialized as JSON
  • /users.stream -> returns a stream of users

my endpoints should return

  • /users -> Single<List<User>>
  • /users/{user_id} -> Single<User>
  • /users.stream -> Observable<User>

Is that correct?

Dave Syer
@dsyer
Mar 31 2016 10:13
I'm not sure the Observable support is available yet
And there's no need for the Single is there?
Jose Armesto
@fiunchinho
Mar 31 2016 10:14
assuming the services that are called from the endpoints return Observable<User>
Dave Syer
@dsyer
Mar 31 2016 10:17
I think there was some debate about it in github
There's still a PR I think
But those features are very close to what Spring is providing in core in 5.0
So it might be that we can't merge it until we know that we won't break all apps when they upgrade to 5.0
Jose Armesto
@fiunchinho
Mar 31 2016 10:35
so at this point is still unclear what the best approach would be when dealing with observables
my goal was to avoid “blocking” myself calling to toList() or toBlocking(), and let Spring do that for me
Thibaud Lepretre
@kakawait
Mar 31 2016 10:37
You could write your own Callable or DeferredResult no?
Jose Armesto
@fiunchinho
Mar 31 2016 10:38
yes, but I’d like to avoid writing the transformation from Observable to DeferredResult myself. It’d nice that Spring do it for you
I was using that, and the same person merged a PR into Spring with similar features, but the ObservableReturnValueHandler is gone in Spring
Thibaud Lepretre
@kakawait
Mar 31 2016 10:40
Yeah remove since spring-cloud/spring-cloud-netflix#778 I didn't read all PR so I can't give you reason (PS: I'm not related to Spring/Pivotal)
Dave Syer
@dsyer
Mar 31 2016 10:44
@spencergibb says at the end there what he merged and what he left out
Jose Armesto
@fiunchinho
Mar 31 2016 11:33
so @spencergibb , following the examples here https://github.com/spring-cloud/spring-cloud-netflix/blob/v1.1.0.RC1/spring-cloud-netflix-core/src/test/java/org/springframework/cloud/netflix/rx/ObservableReturnValueHandlerTest.java , assuming that my Services return Observable<User>, If I want to return a list of users, I have to manually call .toList().toSingle(), and if I want to return one user, I have to call .toSingle(), otherwise, if I just return Observable<User>, Spring won’t know what to return
Marcos Barbero
@marcosbarbero
Mar 31 2016 13:39
@dsyer could you help me with my spring cloud bus doubt?
Dave Syer
@dsyer
Mar 31 2016 13:39
Sorry, I don't know what you mean.
I probably missed or forgot something
Marcos Barbero
@marcosbarbero
Mar 31 2016 13:50
Don't worry. I wrote it down yesterday. My doubt is about spring cloud bus amqp dependency, all my applications will be dependent on the same amqp linked to spring cloud config server, right? Is there a way to point a rabbitmq only for cloud bus? I'm asking that because some of my applications has an amqp dependency and I would like to use a different rabbitmq for bus than application itself.
Dave Syer
@dsyer
Mar 31 2016 13:51
Look at the Spring Cloud Stream docs
You need to configure the binders separately
Marcos Barbero
@marcosbarbero
Mar 31 2016 13:52
I will do that. Thanks
Marcos Barbero
@marcosbarbero
Mar 31 2016 15:40
Thanks @dsyer it will do the trick
twordley
@twordley
Mar 31 2016 19:52
What are you folks using to loadbalance connections to the external side of your zuul reverse proxies?
Marcos Barbero
@marcosbarbero
Mar 31 2016 19:53
@twordley in my case I’m running in multiple datacenters so I have BigIP and Amazon ELB
twordley
@twordley
Mar 31 2016 19:54
@marcosbarbero BigIP at your colo and Amazon ELB in the cloud I am assuming?
Marcos Barbero
@marcosbarbero
Mar 31 2016 19:56
You’re right
Kaleb Scholes
@kalebscholes
Mar 31 2016 21:25
What's the best way to add a custom Param.Expander while using spring-cloud-netflix? It looks like there is ConvertingExpander inside the SpringMvcContract but no real nice way of changing it.. My end goal is to be able to format a date properly so I might even be approaching this wrong. Any ideas?
Matt Benson
@mbenson
Mar 31 2016 21:26
there is no other way. You would have to replace the SpringMvcContract. But the point of the ConvertingExpander is that you can just register Spring converters/formats and have feign just do the right thing
@kalebscholes ^
Kaleb Scholes
@kalebscholes
Mar 31 2016 22:09
@mbenson so once i create my formatter where exactly do i register it?
Matt Benson
@mbenson
Mar 31 2016 22:10
you had to ask me something hard ;)
Kaleb Scholes
@kalebscholes
Mar 31 2016 22:10
haha i figured you know the answers to all my hard questions ;)
Matt Benson
@mbenson
Mar 31 2016 22:12
oh yeah, you just register a Bean implementing FeignFormatterRegistrar and register your converters and formatters, e.g. for a specific date format, from that
that way it's all very specific to Feign and doesn't get mixed up with other conversions
David Welch
@dwelch2344
Mar 31 2016 22:12
our office just erupted with "Oooooh, that's a cool answer"
(mostly from me)
Kaleb Scholes
@kalebscholes
Mar 31 2016 22:12
yeah thanks for that ^^
Matt Benson
@mbenson
Mar 31 2016 22:13
glad if someone found it helpful
Kaleb Scholes
@kalebscholes
Mar 31 2016 22:16
that was exactly what we needed thanks @mbenson!