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

3rd
Jul 2017
Grzegorz Poznachowski
@poznachowski
Jul 03 2017 08:54
Hi, is there any ETA for next Dalston release? (I'm interested in latest changes to spring-cloud-config)
Dave Syer
@dsyer
Jul 03 2017 09:08
Probably could happen soon
We only have 3 projects with a release ready though
Grzegorz Poznachowski
@poznachowski
Jul 03 2017 09:26
thanks
Guillaume DROUET
@gdrouet
Jul 03 2017 14:20
Hi, asked this question on spring boot channel but as suggested I ask it here: when spring boot runs a CommandLineRunner, if I enable spring cloud task, what is the best way to retrieve the task execution ID inside the CommandLineRunner?
Dave Syer
@dsyer
Jul 03 2017 14:20
It depends what you need it for
Can you make it a TaskExecutionListener?
Guillaume DROUET
@gdrouet
Jul 03 2017 14:23
No I have a cyclic dependency error in this case, but I can catch it outside, the main issue is that I set the execution ID in a bean on the fly and assume that when my command line runner reads it it's actually the current execution ID, which works with me but clearly bad from design perspective
Dave Syer
@dsyer
Jul 03 2017 14:24
I guess a sample would help
I'm not sure I follow yet
Guillaume DROUET
@gdrouet
Jul 03 2017 14:25
let me write some code
Dave Syer
@dsyer
Jul 03 2017 14:25
What do you need to do with the id?
Guillaume DROUET
@gdrouet
Jul 03 2017 14:26
I want to log it to see what logs generated by my batch are related to a particular executionId
@Component
public class ImportTask implements CommandLineRunner {

    private long taskExecutionId;

    @BeforeTask
    public void beforeTask(final TaskExecution taskExecution) {
        taskExecutionId = taskExecution.getExecutionId();
    }

    @Override
    public void run(final String... strings) throws Exception {
        // write some logs with the executionId
    }
}
Dave Syer
@dsyer
Jul 03 2017 14:29
Please use fences for code snippets
OK. So aside from the spelling error in the field name, what's wrong with that?
You could just write a sample app and put it in github?
Guillaume DROUET
@gdrouet
Jul 03 2017 14:32
everything is working, just want to check it's the best way to achieve this, because I'm not totally satisfied with this code as I manually plug in to the task life cycle to catch the execution ID
would be better IMO to get an autowired value with a particular task scope or implement a particular CommandLineRunner that takes the TaskExecution as parameter, what do you think?
And this code would even not work if spring cloud task would be able to run several tasks concurrently (I don't know if it's possible)
Dave Syer
@dsyer
Jul 03 2017 14:37
It isn't. So I'm not sure there's really a better solution at present.
Guillaume DROUET
@gdrouet
Jul 03 2017 14:38
Ok thank you
JonathanAaron
@JonathanAaron
Jul 03 2017 14:43
Any of you awesome dev's every use Zuul/Eureka in Kubernetes. K8s isn't load balancing correctly and I'm hoping to use Zuul and spring-clouds service discovery to find all of my pods and round robin correctly.
Tobias Placht
@toplac
Jul 03 2017 14:54

Hi Guys,

we are using parts of Spring Cloud namely Zuul and Ribbon + Hystrix.
We are not using Eureka.

ribbon:
  IsSecure: true
  eureka:
    enabled: false
zuul:
  ignoredServices: '*'
  routes: 
    service1:
      path: /service1/**
      serviceId: service1
      stripPrefix: true
     service2:
      path: /service2/**
      serviceId: service2
      stripPrefix: true

service1:
  ribbon:
    listOfServers: http://localhost:8000/
    ConnectTimeout: 1000
    ReadTimeout: 3000
    MaxTotalHttpConnections: 500
    MaxConnectionsPerHost: 100

hystrix:
  command:
    service1:
      execution:
        isolation:
          thread:
            timeoutInMilliseconds: 1000


service2:
  ribbon:
    listOfServers: https://localhost:8443/
    ConnectTimeout: 1000
    ReadTimeout: 3000
    MaxTotalHttpConnections: 500
    MaxConnectionsPerHost: 100

hystrix:
  command:
    service2:
      execution:
        isolation:
          thread:
            timeoutInMilliseconds: 1000

The problem is only one of the Routes is working depending if ribbon.isSecure is true or false

Is it possible to use Ribbon for Secure and non secure routes?

Dave Syer
@dsyer
Jul 03 2017 15:18
I expect IsSecure is per-client
You set the global default but you didn't override it for the service2 client (the insecure one)
Tobias Placht
@toplac
Jul 03 2017 15:25
so the following should work?
ribbon:
  IsSecure: true
  eureka:
    enabled: false
service2:
  ribbon:
    listOfServers: http://localhost:8443/
    isSecure: false
    ConnectTimeout: 1000
    ReadTimeout: 3000
    MaxTotalHttpConnections: 500
    MaxConnectionsPerHost: 100
Dave Syer
@dsyer
Jul 03 2017 15:56
I would expect so, if you spelled everything correctly.
"isSecure" != "IsSecure"
(and I don't know which is correct - you'd have to check in the Netflic docs)
Tobias Placht
@toplac
Jul 03 2017 15:57
@dsyer thanks, i will give it a try
Tobias Placht
@toplac
Jul 03 2017 17:55
@dsyer using the right spelling, it works as expected ;)
Dave Syer
@dsyer
Jul 03 2017 18:07
:smile: