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

26th
Oct 2015
hacbq
@hacbq
Oct 26 2015 10:49
I'm using spring cloud config version 1.1 snapshop with spring config monitor + spring cloud bus amqp.
I have 2 service + 1 config server. When all services run, only 1 queue with 3 consumers created in rabbit. So when I post to https://localhost:8888/monitor, only 1 service refreshes its config.
Post again, other service refreshes :worried:
If I use cloud bus redis, it's ok
Spencer Gibb
@spencergibb
Oct 26 2015 16:12
@turick You can use @PathVariable or @RequestParam as you would normally.
turick
@turick
Oct 26 2015 16:21
ok thanks spencer. I went ahead and created a class for the request body. still running into very interesting issues -- is it necessary to provide any type of implementation for the interface annotated with @FeignClient?
Spencer Gibb
@spencergibb
Oct 26 2015 16:22
Not sure I understand the question.
Davi Alves
@davicdsalves
Oct 26 2015 16:23
@turick no it's not, Feign will resolve it for you.
turick
@turick
Oct 26 2015 16:23
```@FeignClient(name = "EDGE")
public interface WebSocketClient {
@RequestMapping(value = "/sendPrivateNotification", method = RequestMethod.POST/*, consumes = MediaType.APPLICATION_JSON_VALUE*/)
void sendPrivateNotification(@RequestBody Notification notification);```
sorry, i just messed up the markup
Davi Alves
@davicdsalves
Oct 26 2015 16:23
and create an implementation in runtime
turick
@turick
Oct 26 2015 16:23
ok thanks. where do i imlement the hystrixcallback? my calls to this interface result in instant timeouts and complaints about no fallback
Spencer Gibb
@spencergibb
Oct 26 2015 16:24
in feign?
Davi Alves
@davicdsalves
Oct 26 2015 16:25
according to Feign documentation, a method should look like this
interface GitHub {
  @RequestLine("GET /repos/{owner}/{repo}/contributors")
  List<Contributor> contributors(@Param("owner") String owner, @Param("repo") String repo);
}
you are using spring-mvc annotations, i might be wrong but it doesn't seems to work with it on the FeignClient.
turick
@turick
Oct 26 2015 16:27
here are the errors i'm seeing in my log: 2015-10-26 11:25:19.579 DEBUG 28540 --- [x-http://EDGE-1] c.n.loadbalancer.LoadBalancerContext : EDGE using LB returned Server: 172.18.100.199:8080 for requ
est http:///sendPrivateNotification
2015-10-26 11:25:19.787 DEBUG 28540 --- [x-http://EDGE-1] c.n.l.reactive.LoadBalancerCommand : Got error java.net.HttpRetryException: cannot retry due to
redirection, in streaming mode when executed on server 172.18.100.199:8080
2015-10-26 11:25:19.938 DEBUG 28540 --- [x-http://EDGE-1] c.n.loadbalancer.ZoneAwareLoadBalancer : Zone aware logic disabled or there is only one zone
2015-10-26 11:25:19.938 DEBUG 28540 --- [x-http://EDGE-1] c.n.loadbalancer.LoadBalancerContext : EDGE using LB returned Server: 172.18.100.199:8080 for requ
est http:///sendPrivateNotification
2015-10-26 11:25:20.053 DEBUG 28540 --- [ HystrixTimer-1] com.netflix.hystrix.AbstractCommand : No fallback for HystrixCommand.
java.lang.UnsupportedOperationException: No fallback available.
Davi Alves
@davicdsalves
Oct 26 2015 16:28
Spencer Gibb
@spencergibb
Oct 26 2015 16:28
@davicdsalves we support spring-mvc annotations
Davi Alves
@davicdsalves
Oct 26 2015 16:28
@spencergibb cool didn't know.
Spencer Gibb
@spencergibb
Oct 26 2015 16:28
@turick there is no support for a fallback with hystrix and feign yet
Davi Alves
@davicdsalves
Oct 26 2015 16:29

but on hystrix github it states this @spencergibb

For asynchronous or reactive use, return HystrixCommand<YourType> rather than just YourType.

Spencer Gibb
@spencergibb
Oct 26 2015 16:29
I know, I built it.
Davi Alves
@davicdsalves
Oct 26 2015 16:29
?
Spencer Gibb
@spencergibb
Oct 26 2015 16:29
there’s no support for “fallback"
I built the hystrix support in feign
turick
@turick
Oct 26 2015 16:30
oh gotcha. can i autowire in my @FeignClient interface where i want to use it, then just call the methods i provided? is there any ned to use the Feign.builder() or is that directly for the netflix oss project?
Spencer Gibb
@spencergibb
Oct 26 2015 16:30
@davicdsalves if you use hystrix by hand or using @HystrixCommand you can specify a fallback. That isn’t supported in feign yet.
using hystrix is, just not the fallback
Davi Alves
@davicdsalves
Oct 26 2015 16:30
I see
Spencer Gibb
@spencergibb
Oct 26 2015 16:31
@turick you should be able to auto wire if you used @EnableFeignClients.
turick
@turick
Oct 26 2015 16:35
great. I have my main class annotated with @EnableFeignClients. From the logs, it is actually looking up my "EDGE" service, finds the ip, but then gives me some funky errors and immediately times out
Spencer Gibb
@spencergibb
Oct 26 2015 16:36
I noticed there was a redirect in there. c.n.l.reactive.LoadBalancerCommand : Got error java.net.HttpRetryException: cannot retry due to redirection, in streaming mode when executed on server 172.18.100.199:8080
not sure what that means
turick
@turick
Oct 26 2015 16:38
i've found similar errors while searching that say due to authentication instead of redirection
i have spring security set to redirect unauthorized requests to a login page (kind of a unique security setup), but i have antMatchers set up to allow the two endpoints i'm trying to hit
without being authenticated. i wonder if that's not kicking in for some reason
turick
@turick
Oct 26 2015 18:51
99% sure that was it -- we had zuul running in a docker container that didn't have the latest update. after updating it to tell it to allow requests to the two endpoints /sendPrivateNotification and /sendPublicNotification, and after updating my feign client with the proper consumes value in the request mapping, everything is working now
the feign client does make it super convenient to make rest requests in this architecture :)