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

13th
Jun 2016
failed to upgrade spring cloud to Brixton.SR1 with Maven
Dave Syer
@dsyer
Jun 13 2016 06:18 UTC
There's nothing in maven central yet
And we haven't announced the release
Thibaud Lepretre
@kakawait
Jun 13 2016 07:40 UTC
I think the confusion comes from http://projects.spring.io/spring-cloud/ that offers spring-cloud-dependencies:Brixton.SR1 but without adding spring (artifactory) mvn repositories
Dave Syer
@dsyer
Jun 13 2016 07:58 UTC
I know. Sorry. Things got done a bit out of order.
Thibaud Lepretre
@kakawait
Jun 13 2016 08:19 UTC
No need to be sorry :p
Dave Syer
@dsyer
Jun 13 2016 09:19 UTC
It will work with the repo.spring.io until we sort out the maven central thing
Spencer was doing it and he needs to finish something
Włodzimierz Rożkow
@rozhok
Jun 13 2016 10:09 UTC
just discovered that eureka din't work properly in private AWS subnets. public ip and hostnames is empty (nulls actually) and ribbon for some reason tries to use public ones
so I have to hack config a bit to put private ips and hostnames into public fields, and after that all works as expected
this is how is look eureka app without hack:
     {
        "name": "OTP",
        "instance": {
          "hostName": "null",
          "app": "OTP",
          "ipAddr": "null",
          "status": "UP",
          "overriddenstatus": "UNKNOWN",
          "dataCenterInfo": {
            "@class": "com.netflix.appinfo.AmazonInfo",
            "name": "Amazon",
            "metadata": {
              "public-ipv4": "null",
              "local-hostname": "ip-10-0-29-179.eu-west-1.compute.internal",
              "public-hostname": "null",
              "instance-id": "i-031dreqqb203ffe",
              "local-ipv4": "10.0.29.179",
              "ami-manifest-path": "(unknown)",
              "instance-type": "t2.small",
              "ami-launch-index": 0,
              "ami-id": "ami-4e6ffe3d",
              "availability-zone": "eu-west-1a"
            }
          },
          "homePageUrl": "null",
          "statusPageUrl": "null",
          "healthCheckUrl": "null",
          "vipAddress": "otp",
          "isCoordinatingDiscoveryServer": false,
          "lastUpdatedTimestamp": 1465646791477,
          "lastDirtyTimestamp": 1465646791408,
          "actionType": "ADDED"
        }
      },
Dave Syer
@dsyer
Jun 13 2016 10:12 UTC
how do you fix it?
Shouldn't we document it? Or do you think there would be a fix in the framework.
Włodzimierz Rożkow
@rozhok
Jun 13 2016 10:13 UTC
This is how I workarounded it
@Bean
@Profile("docker")
public EurekaInstanceConfigBean eurekaInstanceConfig() {
    EurekaInstanceConfigBean config = new EurekaInstanceConfigBean();
    AmazonInfo info = AmazonInfo.Builder.newBuilder().autoBuild("eureka");
    config.setDataCenterInfo(info);
    info.getMetadata().put(AmazonInfo.MetaDataKey.publicHostname.getName(), EC2MetadataUtils.getLocalHostName());
    config.setHostname(EC2MetadataUtils.getLocalHostName());
    config.setIpAddress(EC2MetadataUtils.getPrivateIpAddress());
    config.setNonSecurePort(port);
    return config;
}
I'm not sure how NetFlix does deployment
but there even no private-ipv4 property in AmazonInfo class out of NetFlix package
Dave Syer
@dsyer
Jun 13 2016 10:15 UTC
That doesn't look like a hack to me. But it's quite AWS specific.
Włodzimierz Rożkow
@rozhok
Jun 13 2016 10:16 UTC
You don't have such problems in CF deployments?
Dave Syer
@dsyer
Jun 13 2016 10:19 UTC
No. It's not using AWS meta data in CF.
Włodzimierz Rożkow
@rozhok
Jun 13 2016 10:20 UTC
well, sure it's shouldn't use AWS metadata
I mean, i CF you always have public IPs on instances?
aaa
Dave Syer
@dsyer
Jun 13 2016 10:21 UTC
It depends
Włodzimierz Rożkow
@rozhok
Jun 13 2016 10:22 UTC
ok
got it
actually it uses ipAddr property
so that's why it failed to work
Jakub Kubryński
@jkubrynski
Jun 13 2016 20:22 UTC
Hi! Is there any option to avoid calling hystrix fallback for feign calls which returns error? e.g. when I receive 410 I want to get it as a response instead of calling fallback
Spencer Gibb
@spencergibb
Jun 13 2016 20:25 UTC
No I don’t think so
Jakub Kubryński
@jkubrynski
Jun 13 2016 20:27 UTC
imho it's a little bit strange, because sometimes we return different status codes to flag some business exception (like 410 -> reservation is no longer available) and calling fallback in such situation is not the best idea
Spencer Gibb
@spencergibb
Jun 13 2016 20:28 UTC
it’s possible to get the exception in the fallback
Jakub Kubryński
@jkubrynski
Jun 13 2016 20:28 UTC
any ideas for some workaround? I still want to use hystrix for handling cascading failures
Spencer Gibb
@spencergibb
Jun 13 2016 20:28 UTC
in hystrix normally. Unsure if it work with the feign integration
Jakub Kubryński
@jkubrynski
Jun 13 2016 20:29 UTC
but fallback should be used when I want to provide fallback - not for decoding status codes which are different than 2xx
it's normal situation to use 4xx statuses to flag some particular business situation
Spencer Gibb
@spencergibb
Jun 13 2016 20:30 UTC
feigns hystrix integration may not be the way for you then.
Jakub Kubryński
@jkubrynski
Jun 13 2016 20:31 UTC
hystrix is used for cascading failures - I still want to use it for this usecase. I just don't want it to intercept all exceptions
I think it should be configurable when hystrix fallback is applied
Spencer Gibb
@spencergibb
Jun 13 2016 20:32 UTC
it can be done when using hystrix programatically
Jakub Kubryński
@jkubrynski
Jun 13 2016 20:32 UTC
everything other than 2xx is not very comfortable
with manual approach I can do everything :)
the question is if it's just my problem or something that could be provided to other users also
all rest implementations I saw were using status codes to return errors
Dave Syer
@dsyer
Jun 13 2016 20:35 UTC
It's feign that doesn't treat 4xx as an error
Jakub Kubryński
@jkubrynski
Jun 13 2016 20:36 UTC
what do you mean?
Spencer Gibb
@spencergibb
Jun 13 2016 20:37 UTC
I believe it’s an option
Dave Syer
@dsyer
Jun 13 2016 20:37 UTC
Actually I'm not sure
Jakub Kubryński
@jkubrynski
Jun 13 2016 20:37 UTC
as I know there is some configuration for 404 only
Dave Syer
@dsyer
Jun 13 2016 20:37 UTC
Now I think about it I remember it the other way round
4xx is an error and there's no way to opt out
You could use @HystrixCommand in a method that called a RestTemplate and it would throw an exception and do the fallback. I'm pretty sure that works.
Hystrix itself knows nothing about HTTP
So I'm confused about the feign case
Jakub Kubryński
@jkubrynski
Jun 13 2016 20:39 UTC
yep - imho the problem is with feign which calls an error decoder everytime response status is other than 2xx
it's SynchronousMethodHandler.executeAndDecode imho
Spencer Gibb
@spencergibb
Jun 13 2016 20:40 UTC
you can plugin your own error decoder
Jakub Kubryński
@jkubrynski
Jun 13 2016 20:41 UTC
I have my own decoder
but it still needs to return Exception class
I think I found the real problem
just give me few secs
it looks like everything is OK when my feign method returns feign.Response. Then it's not decoded and I get what I want
when we return ResponseEntity then feign ignores it and treats it as a normal response object like User, Product or Car
I expected Feign called in cloud to be ResponseEntity aware
but as I see it's not :(
Spencer Gibb
@spencergibb
Jun 13 2016 20:46 UTC
it is, we have tests for it
Jakub Kubryński
@jkubrynski
Jun 13 2016 20:47 UTC
hmm -> as I see in SynchronousMethodHandler.executeAndDecode there is no support for that
the only exception is if (Response.class == metadata.returnType()) {
do I miss something?
Spencer Gibb
@spencergibb
Jun 13 2016 20:49 UTC
it works in non-error conditions
Jakub Kubryński
@jkubrynski
Jun 13 2016 20:49 UTC
exactly!
Spencer Gibb
@spencergibb
Jun 13 2016 20:50 UTC
how could we have support for it in SynchronousMethodHandler.executeAndDecode?
Jakub Kubryński
@jkubrynski
Jun 13 2016 20:50 UTC
I don't see such option right now in feign. I think feign should provide extension point here
Spencer Gibb
@spencergibb
Jun 13 2016 20:50 UTC
I think it was a mistake to support spring mvc annotations and classes for feign
Dave Syer
@dsyer
Jun 13 2016 20:51 UTC
Too late
Spencer Gibb
@spencergibb
Jun 13 2016 20:51 UTC
yeah
Dave Syer
@dsyer
Jun 13 2016 20:52 UTC
We can add an extension point to feign though
Spencer Gibb
@spencergibb
Jun 13 2016 20:52 UTC
yup
Jakub Kubryński
@jkubrynski
Jun 13 2016 20:52 UTC
the question is how many such points are still required
Dave Syer
@dsyer
Jun 13 2016 20:53 UTC
One step at a time...
Jakub Kubryński
@jkubrynski
Jun 13 2016 20:53 UTC
it's still much easier to do responseEntity.getBody() than get raw inputStream from feign
Spencer Gibb
@spencergibb
Jun 13 2016 20:54 UTC
Feign isn’t a silver bullet.
Jakub Kubryński
@jkubrynski
Jun 13 2016 20:54 UTC
that's why I prefer ResponseEntity :)
Spencer Gibb
@spencergibb
Jun 13 2016 20:55 UTC
then don’t use feign
Jakub Kubryński
@jkubrynski
Jun 13 2016 20:55 UTC
I lived in the belief that it works out of the box :)
Johannes Edmeier
@joshiste
Jun 13 2016 21:04 UTC
cloud.spring.io says Brixton.SR1 is the current release. But it's not on repo1.maven.org :worried:
Is the release not finished yet?
ok didn't read the chat-history
no answer necessary