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

4th
Sep 2015
Leon Radley
@leon
Sep 04 2015 07:09
How can I log the outgoing feign requests?
I need to debug what is being sent and received
Dave Syer
@dsyer
Sep 04 2015 07:26
I guess the underlying HTTP client?
Apache is it?
Leon Radley
@leon
Sep 04 2015 07:28
I’ve just imported the spring-cloud-starter-feign, and I’m running 1.3.0.M4
Is Apache the default?

Since this is a simple app for a customer where they have a backend that I’m going to call and then manipulate it a bit and forward it to a angular client.
I don’t really need the load balancing stuff.

on the @FeignClient i can specify a url, but can I have that stored in the application.yml?
and how do I add the custom auth header?

Dave Syer
@dsyer
Sep 04 2015 07:33
I think it's Apache
For the auth header there's an interceptor strategy
If I create a RequestInterceptor and mark it as a @Component will that get used?
Dave Syer
@dsyer
Sep 04 2015 07:35
I don't think it's that simple
Leon Radley
@leon
Sep 04 2015 07:35
it never is :)
Dave Syer
@dsyer
Sep 04 2015 07:35
With Ribbon you would configure the Ribbon client (relatively straightforward)
I also saw someone doing it with @RequestHeader
But I'm not sure that feels right to me
(nor do I know if it actually worked in practice)
Leon Radley
@leon
Sep 04 2015 07:36
In this case it’s a really bad designed api, so the key needs to be sent as a query string variable
Dave Syer
@dsyer
Sep 04 2015 07:36
Ah. Then it should be easier
Leon Radley
@leon
Sep 04 2015 07:36
/backapi/portal.aspx?key=abc123&cmd=getcustomer&id=123
Dave Syer
@dsyer
Sep 04 2015 07:36
Feign (I'm sure) has support for request parameters
via method args
It probably has support for request headers via method args
so I imagine you could do headers that way as well
Leon Radley
@leon
Sep 04 2015 07:37
What do you mean by that?
method args?
Dave Syer
@dsyer
Sep 04 2015 07:38
@RequestMapping(value = "/{foo}", method = RequestMethod.GET)
String hello(@PathVariable String foo, @RequestParam String bar);
Something like that (I didn't try it)
Leon Radley
@leon
Sep 04 2015 07:39

I’ve got this
public interface CustomerClient {

@RequestMapping(method = RequestMethod.GET, path = "/backapi/portal.aspx", params = {"key=123", "cmd=getcustomer", "id={customerId}"}, consumes = "application/json")
Customer get(@RequestParam("customerId") Long customerId);

}

Dave Syer
@dsyer
Sep 04 2015 07:40
I don't know what params= does in this context
Leon Radley
@leon
Sep 04 2015 07:40
I’ll have to try it out
Dave Syer
@dsyer
Sep 04 2015 07:40
Me too
You go first
Leon Radley
@leon
Sep 04 2015 07:40
yes
Leon Radley
@leon
Sep 04 2015 07:48
@RequestMapping(params…) doesn’t do anything
Can I use the standard Feign annotations also, or is spring cloud only going to work with @RequestMapping?
Leon Radley
@leon
Sep 04 2015 08:28
@spencergibb Would it be possible to add support for the native feign annotations?
Dave Syer
@dsyer
Sep 04 2015 09:12
I don't think @RequestMapping(params) should do anything
Leon Radley
@leon
Sep 04 2015 09:15
I’ve got past that now, but I’m getting a null pointer in FeignClientsConfiguration, the messageConverters @Autowired is null
@Autowired
private ObjectFactory<HttpMessageConverters> messageConverters;
shouldn’t this get populated with the default spring message converters?
Dave Syer
@dsyer
Sep 04 2015 09:19
Yes. It's null, not NoSuchBeanException?
Leon Radley
@leon
Sep 04 2015 09:38
If I drop back to spring boot 1.2.5 and Angel.SR3 it works
so it must be something with the newer releases causing it
Dave Syer
@dsyer
Sep 04 2015 09:47
Ah. We need to invoke @adriancole and @spencergibb .
They will be around later (timezones)
Leon Radley
@leon
Sep 04 2015 09:47
okey
Dave Syer
@dsyer
Sep 04 2015 09:47
If you have a really simple project that reproduces the problem it will help
Leon Radley
@leon
Sep 04 2015 09:48
I’ll see what I can do
Leon Radley
@leon
Sep 04 2015 12:31
I wasn’t able to reproduce the error in a smaller project, so I’ll leave it for now
Dave Syer
@dsyer
Sep 04 2015 13:21
It sounds like an eager instantiation
You might be able to tell from the logs when the context is starting
Spencer Gibb
@spencergibb
Sep 04 2015 13:30
@dsyer I believe I have a project that reproduces the eager instantiation problem
Dave Syer
@dsyer
Sep 04 2015 13:30
Cool
Spencer Gibb
@spencergibb
Sep 04 2015 13:32
A number of people have run across this. Give me a bit to find it
Leon Radley
@leon
Sep 04 2015 13:59
awesome!
Spencer Gibb
@spencergibb
Sep 04 2015 13:59
can’t find the project :-(
Adrian Cole
@adriancole
Sep 04 2015 14:17
how did I not look for this room :)
Spencer Gibb
@spencergibb
Sep 04 2015 14:17
welcome
Adrian Cole
@adriancole
Sep 04 2015 14:18
gracias
@leon having fun?
I will be in your timezone next week due to javazone
adriancole @adriancole concedes the rhyme is totally intentional
Leon Radley
@leon
Sep 04 2015 14:19
It’s a bit frustrating at times, but It’s been a blast the last year
working on some quite large spring projects :)
Adrian Cole
@adriancole
Sep 04 2015 14:20
yeah?
I think last year was about 2.5 years for me :P