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

10th
Nov 2015
ccit-spence
@ccit-spence
Nov 10 2015 08:41
Are there any examples of Spring Data Rest and Feign, Discovery Client or Rest Template where Ribbon and Hystrix are used? Still can’t get deserilization to work properly. I get the Page results but no content. In a non Spring Cloud setup it works fine.
Dave Syer
@dsyer
Nov 10 2015 12:07
You mean where the server is SDR and the client wants to use Ribbon?
ccit-spence
@ccit-spence
Nov 10 2015 16:48
@dsyer Yes, a Spring MVC service consuming a separate Spring Data Rest service. Spring MVC is the client no javascript. The Controller would use a Service that consumes a Spring Data Rest endpoint.
Dave Syer
@dsyer
Nov 10 2015 16:49
The canonical customers-stores sample uses SDR for the services
the customers service uses ribbon and eureka I think
the customersui uses Zuul (hence ribbon and eureka) as well
No Feign there.
ccit-spence
@ccit-spence
Nov 10 2015 16:51
The UI is an AngularJS frontend?
What I am looking for is something with a Spring MVC frontend.
With a javascript UI you can target the endpoint a little easier
Dave Syer
@dsyer
Nov 10 2015 16:55
customers is a Spring Rest client
Why is the UI layer relevant?
ccit-spence
@ccit-spence
Nov 10 2015 16:56
It may not be, I may have been trying the wrong approach to make it work
Dave Syer
@dsyer
Nov 10 2015 16:57
I guess customers is a little unusual in that it uses the LoadBalancerClient API directly
I would have thought you could just use a load balanced RestTemplate and the Resource* domain from SDR
ccit-spence
@ccit-spence
Nov 10 2015 16:57
My thought was something like the way you would use Rest Template without Spring Cloud
Dave Syer
@dsyer
Nov 10 2015 16:57
(actually Spring HATEOAS)
ccit-spence
@ccit-spence
Nov 10 2015 16:58
I can’t get the load balanced RestTemplate to work
Dave Syer
@dsyer
Nov 10 2015 16:58
How are you using it?
ccit-spence
@ccit-spence
Nov 10 2015 16:58
I can get a standard RestTemplate to work
Lookup a little in this chat window and you can see the config
The Customer example might work for what I am trying to do. I basically would like to use the endpoint the same as you would a Spring Data JPA model in a Spring MVC app
But, have Ribbon and Hystrix in the mix
Dave Syer
@dsyer
Nov 10 2015 17:05
I don't know why MVC is relevant. Still a bit confused sorry.
ccit-spence
@ccit-spence
Nov 10 2015 17:05
Feign is an obvious choice to me, could be the decoder but I can’t get a object from Feign
Dave Syer
@dsyer
Nov 10 2015 17:05
Maybe you could paste a link to a project?
ccit-spence
@ccit-spence
Nov 10 2015 17:05
I would need to create a smaller project.
I can would not take long
Dave Syer
@dsyer
Nov 10 2015 17:07
I'm not sure why ribbon would change anything in the serialization layer
A complete project would be useful
ccit-spence
@ccit-spence
Nov 10 2015 17:07
Sure, I will put one together
with Ribbon I see the response body with the number of elements returned with no content
without Ribbon I can get the Paged content
Dave Syer
@dsyer
Nov 10 2015 17:09
Sounds like you are sending different requests
ccit-spence
@ccit-spence
Nov 10 2015 17:10
Standard RestTemplate Only works after adding this
    @Bean
    RestTemplate restTemplate() {

        ObjectMapper mapper = new ObjectMapper();
        mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
        mapper.registerModule(new Jackson2HalModule());

        MappingJackson2HttpMessageConverter converter = new MappingJackson2HttpMessageConverter();
        converter.setSupportedMediaTypes(MediaType.parseMediaTypes("application/hal+json"));
        converter.setObjectMapper(mapper);
        return new RestTemplate(Arrays.asList(converter));

    }
Apparently RestTemplate sends a plain text request by default. (could be wrong).
Dave Syer
@dsyer
Nov 10 2015 17:12
Wouldn't that be on by default if you use Spring HATEOAS?
("customers" doesn't do that AFAIK)
ccit-spence
@ccit-spence
Nov 10 2015 17:12
Is customers really deseralizing it though
Spencer Gibb
@spencergibb
Nov 10 2015 17:13
customers uses Traverson which does it for you
ccit-spence
@ccit-spence
Nov 10 2015 17:14
Should I be using Traverson instead?
Dave Syer
@dsyer
Nov 10 2015 17:14
You can @EnableHypermediaSupport though
I thought Spring Boot did it for you
Traverson is nice if you are using the links
But you should be able to get it working without
Spencer Gibb
@spencergibb
Nov 10 2015 17:14
Traverson doesn’t have ribbon and discovery support, which is why customers uses LoadBalancerClient directly.
ccit-spence
@ccit-spence
Nov 10 2015 17:16
I think it best to make an app to better describe the issue I am having
Dave Syer
@dsyer
Nov 10 2015 17:16
The sample from Spring One has a load balanced rest template as well:
ccit-spence
@ccit-spence
Nov 10 2015 17:16
Could easily be me not knowing what I am doing
ccit-spence
@ccit-spence
Nov 10 2015 17:19
The examples look promising
Adrian Cole
@adriancole
Nov 10 2015 18:01
@dsyer @spencergibb so I need to switch zipkin's java server to accept gzip encoding
I noticed some comment about spring boot 1.3 automagically doing this
personally I always like to try release candidates, but I recall some resistance to bumping zipkin-java to that
Dave Syer
@dsyer
Nov 10 2015 18:02
Resistance from where?
Adrian Cole
@adriancole
Nov 10 2015 18:02
you :)
you said wait until final
Dave Syer
@dsyer
Nov 10 2015 18:02
Really?
Adrian Cole
@adriancole
Nov 10 2015 18:02
maybe your alter ego did :P
Dave Syer
@dsyer
Nov 10 2015 18:03
We normally do an rc phase of Spring Projects, so I don't know why either of us would object.
Adrian Cole
@adriancole
Nov 10 2015 18:03
sgtm
(Link including Tomcat)
Adrian Cole
@adriancole
Nov 10 2015 18:04
@spencergibb @dsyer thanks for the link :P
links
turick
@turick
Nov 10 2015 18:15
@ccit-spence on your feign client, are you providing the right consumes value in your @RequestMapping attribute? also can you packet sniff using wireshark or something to see the response payload to verify if the actual data is there and verify it's just a deserialization issue?
ccit-spence
@ccit-spence
Nov 10 2015 18:28
@turick I am going to make a new project that has the things I have tried. The other project is way to big and has since dropped support for SDR for now
ccit-spence
@ccit-spence
Nov 10 2015 21:31
@spencergibb @dsyer @turick I finally got around to starting the example project
It only has the RestTemplate example of the problem right now. Have some other things to do and will try to add feign shortly
A possible Bug I noticed is any time I make a change within the mvc app that forces Spring Dev Tools to reload ribbon will throw a 500
Dave Syer
@dsyer
Nov 10 2015 21:46
devtools and ribbon is a whole other story
But a simple project that reproduces the issue is good
ccit-spence
@ccit-spence
Nov 10 2015 21:47
lol, just thought I would mention it