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

3rd
Nov 2017
redtankd
@redtankd
Nov 03 2017 01:27
@dsyer Yes, I put a mock class in server side now. I have opened a ticket #838.
thank you!
Mark Corkery
@KramKroc
Nov 03 2017 09:01
Hi folks, I’m autowiring an instance of EurekaClient into a conditional @Configuration class. When I do, the server port being pushed to Eureka has been set to zero. I’m not entirely sure why that is happening, but wondered if it is something that is known/has a solution before I try to create a smaller project to demo the behaviour?
Dave Syer
@dsyer
Nov 03 2017 09:02
A small project would help
It's probably a lifecycle issue.
Mark Corkery
@KramKroc
Nov 03 2017 09:02
OK @dsyer
Dave Syer
@dsyer
Nov 03 2017 09:03
You forced instantiation to happen too early somehow
Mark Corkery
@KramKroc
Nov 03 2017 09:03
Yeah, I believe that to be the case but can’t see the path to resolving it. I’ll throw something together to illustrate the problem
Dave Syer
@dsyer
Nov 03 2017 09:03
Probably fixable by breaking up the configuration into smaller chunks that don't depend on themselves
Mark Corkery
@KramKroc
Nov 03 2017 11:34
No luck reproducing that on a smaller project unfortunately
Mark Corkery
@KramKroc
Nov 03 2017 13:33

The only thing I see when things go wrong in the more complex project, is that after the EurekaClient is wired in, a call is made to register the app as STARTING in Eureka. At this point the port hasn’t been set and so it’s registering with incomplete date:

2017-11-03 13:26:11.137  INFO 39061 --- [           main] c.v.m.c.z.c.ZipkinConfig                 : Creating ZipkinSpanReporter @ Highest
2017-11-03 13:26:11.150  INFO 39061 --- [           main] o.s.c.n.e.InstanceInfoFactory            : Setting initial instance status as: STARTING

whereas when it works, the registration doesn’t happen until later, when the port has been defned etc and as such the homePageURL value is correct with the right port.

Mark Corkery
@KramKroc
Nov 03 2017 13:39
In some ways it is similar to this issue: spring-cloud/spring-cloud-netflix#1541
But I don’t understand the point by @spencergibb around listening for an InstanceRegisteredEvent.
Dave Syer
@dsyer
Nov 03 2017 13:49
Definitely looks like you triggered an early instantiation.
Mark Corkery
@KramKroc
Nov 03 2017 13:49
Yep. Surprised it doesn’t appear in a cut dow version of problem
Dave Syer
@dsyer
Nov 03 2017 13:49
That's life I guess.
If it was that easy, someone else would have had the same problem
Mark Corkery
@KramKroc
Nov 03 2017 13:50
:D
Dave Syer
@dsyer
Nov 03 2017 13:50
Whatever it is it's your config that's pushed it over the edge
Mark Corkery
@KramKroc
Nov 03 2017 13:50
Yep
Dave Syer
@dsyer
Nov 03 2017 13:50
You can set a break point in the thing that registers with eureka
That will tell you why it started early (in the stack)
Mark Corkery
@KramKroc
Nov 03 2017 13:51
Is there anyway to “force” it to happen later in lifecycle, e.g. phase other than 0?
Dave Syer
@dsyer
Nov 03 2017 13:52
Not if you have already forced it to happen too early
You are injecting it (or something that depends on it) into something that is initialized early
Only you can say what that might be
But the stack will tell you in the debugger
Mark Corkery
@KramKroc
Nov 03 2017 14:02
@dsyer So, switched to use org.springframework.cloud.client.discovery.DiscoveryClient and it works
my brain hurts :D
Thanks for the help and the pointers
Dave Syer
@dsyer
Nov 03 2017 14:03
That makes sense
It only instantiates the eureka client lazily.
Mark Corkery
@KramKroc
Nov 03 2017 14:04
:+1:
Dave Syer
@dsyer
Nov 03 2017 14:04
(Precisely to prevent this kind of issue)
Mark Corkery
@KramKroc
Nov 03 2017 14:04
Ha
Last question on that @dsyer, is there a way to round robin ServiceInstance calls, i.e in a loadbalanced fashion?
Dave Syer
@dsyer
Nov 03 2017 14:13
AFAIK that's what ribbon does by default
Could be wrong.
But it's a feature
Charles (Ted) Wise
@ctwise
Nov 03 2017 18:41
hey guys, trying to use spring cloud finchley and my spring config client isn't working correctly
i used to use this in my bootstrap.yml to access the config server through eureka...
spring:
application:
name: "my-app"
cloud:
config:
username: "${CONFIG_USER:configuser}" # Pass in the configuration server username as CONFIG_USER or default to 'configuser'
password: "${CONFIG_PASS:password}" # Pass in the configuration server password as CONFIG_PASS
discovery:
enabled: true # Use Eureka to find the configuration server under the default name CONFIGSERVER
that doesn't work with finchley (spring cloud config 2.0.0.M2)
wireshark shows that the username and password aren't being used and neither is the spring.application.name (it's defaulting to 'application')
any ideas?
Dave Syer
@dsyer
Nov 03 2017 19:27
What version of spring boot?
Charles (Ted) Wise
@ctwise
Nov 03 2017 19:47
spring boot 5
using kotlin as the language
it looks like the bootstrap.yml isn't being read
or at least not fully read
Dave Syer
@dsyer
Nov 03 2017 20:56
That’s why I asked which version of Spring boot. You didn’t tell me yet. I would guess your cloud and boot versions don’t match.
Charles (Ted) Wise
@ctwise
Nov 03 2017 23:57
That's a great idea. I'll check.