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>
<packaging>jar</packaging>
<dependencies>
<dependency>
<groupId>org.glassfish.jersey.inject</groupId>
<artifactId>jersey-hk2</artifactId>
<version>2.27</version>
</dependency>
<dependency>
<groupId>org.glassfish.jersey.core</groupId>
<artifactId>jersey-client</artifactId>

View File

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