support Reactor-based CF Java Client (#22)

* reactive Cloud Foundry Java Client

- new support for auto-configuring the reactor-based CF java client v3.3.
- reworkd the `DiscoveryClient` to depend on the standalone support.
- made the tests run conditionally based on presence of certain env vars.

fixes gh-21
This commit is contained in:
Josh Long
2018-01-08 13:45:02 -08:00
committed by Spencer Gibb
parent 2a310c2eec
commit fef7d2c9a7
23 changed files with 870 additions and 851 deletions

View File

@@ -16,14 +16,11 @@
package org.springframework.cloud.cloudfoundry.sample;
import java.util.List;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.ServiceInstance;
import org.springframework.cloud.cloudfoundry.discovery.CloudFoundryDiscoveryClient;
import org.springframework.cloud.cloudfoundry.discovery.EnableCloudFoundryClient;
import org.springframework.context.annotation.Bean;
@@ -47,31 +44,13 @@ public class CloudFoundryApplication {
SpringApplication.run(CloudFoundryApplication.class, args);
}
private Log log = LogFactory.getLog(getClass());
@Bean
CommandLineRunner consume(final CloudFoundryDiscoveryClient discoveryClient) {
return new CommandLineRunner() {
@Override
public void run(String... args) throws Exception {
// this demonstrates using the Spring Cloud Commons DiscoveryClient
// abstraction
log.info("=====================================");
for (String svc : discoveryClient.getServices()) {
CommandLineRunner demo(CloudFoundryDiscoveryClient discoveryClient) {
Log log = LogFactory.getLog(getClass());
return args ->
discoveryClient.getServices().forEach(svc -> {
log.info("service = " + svc);
List<ServiceInstance> instances = discoveryClient.getInstances(svc);
for (ServiceInstance si : instances) {
log.info("\t" + si);
}
}
log.info("=====================================");
log.info("local: ");
log.info("\t" + discoveryClient.getLocalServiceInstance());
}
};
discoveryClient.getInstances(svc).forEach(si -> log.info("\t" + si));
});
}
}