Add files via upload

This commit is contained in:
k0l0ssus 2018-07-29 23:36:33 -04:00 committed by GitHub
parent c195c5dc50
commit 075ba76de1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 18 deletions

View File

@ -6,6 +6,11 @@
<version>1.0</version> <version>1.0</version>
<packaging>jar</packaging> <packaging>jar</packaging>
<dependencies> <dependencies>
<dependency>
<groupId>org.glassfish.jersey.inject</groupId>
<artifactId>jersey-hk2</artifactId>
<version>2.27</version>
</dependency>
<dependency> <dependency>
<groupId>org.glassfish.jersey.core</groupId> <groupId>org.glassfish.jersey.core</groupId>
<artifactId>jersey-client</artifactId> <artifactId>jersey-client</artifactId>

View File

@ -28,9 +28,9 @@ import rx.Observable;
public class ClientOrchestration { public class ClientOrchestration {
Client client = ClientBuilder.newClient(); Client client = ClientBuilder.newClient();
WebTarget userIdService = client.target("http:localhost:8080/serviceA/id?limit=10"); WebTarget userIdService = client.target("http://localhost:8080/serviceA/id?limit=10");
WebTarget nameService = client.target("http:localhost:8080/serviceA/{empId}/name"); WebTarget nameService = client.target("http://localhost:8080/serviceA/{empId}/name");
WebTarget hashService = client.target("http:localhost:8080/serviceA/{comboIDandName}/address"); WebTarget hashService = client.target("http://localhost:8080/serviceA/{comboIDandName}/address");
Logger logger = Logger.getLogger("ClientOrchestrator"); Logger logger = Logger.getLogger("ClientOrchestrator");
@ -73,6 +73,7 @@ public class ClientOrchestration {
} }
}); });
} }
@Override @Override
public void failed(Throwable throwable) { public void failed(Throwable throwable) {
completionTracker.countDown(); completionTracker.countDown();
@ -109,12 +110,8 @@ public class ClientOrchestration {
return null; return null;
}); });
CompletionStage<List<CompletionStage<String>>> completedNameStage = userIdStage.thenApplyAsync(list -> list.stream().map((Long id) -> {
CompletionStage nameStage = nameService.resolveTemplate("empId", id).request().rx().get(String.class);
}).collect(Collectors.toList()));
userIdStage.thenAcceptAsync(listOfIds -> { userIdStage.thenAcceptAsync(listOfIds -> {
listOfIds.stream().map((Long id) -> { listOfIds.stream().forEach((Long id) -> {
CompletableFuture<String> completable = nameService.resolveTemplate("empId", id) CompletableFuture<String> completable = nameService.resolveTemplate("empId", id)
.request() .request()
.rx() .rx()
@ -143,10 +140,7 @@ public class ClientOrchestration {
public void observableJavaOrchestrate() { public void observableJavaOrchestrate() {
logger.info("Orchestrating with Observables"); logger.info("Orchestrating with Observables");
Observable<List<Long>> userIdObservable = userIdService.register(RxObservableInvokerProvider.class).request()
client.register(RxObservableInvokerProvider.class);
Observable<List<Long>> userIdObservable = userIdService.request()
.rx(RxObservableInvoker.class) .rx(RxObservableInvoker.class)
.get(new GenericType<List<Long>>() { .get(new GenericType<List<Long>>() {
}); });
@ -173,10 +167,7 @@ public class ClientOrchestration {
public void flowableJavaOrchestrate() { public void flowableJavaOrchestrate() {
logger.info("Orchestrating with Flowable"); logger.info("Orchestrating with Flowable");
Flowable<List<Long>> userIdObservable = userIdService.register(RxFlowableInvokerProvider.class).request()
client.register(RxFlowableInvokerProvider.class);
Flowable<List<Long>> userIdObservable = userIdService.request()
.rx(RxFlowableInvoker.class) .rx(RxFlowableInvoker.class)
.get(new GenericType<List<Long>>() { .get(new GenericType<List<Long>>() {
}); });