Skip to content

Instantly share code, notes, and snippets.

@railroadman
Last active March 1, 2023 20:29
Show Gist options
  • Save railroadman/5ea1799ecb2fdcfd4c83b4a969c364c9 to your computer and use it in GitHub Desktop.
Save railroadman/5ea1799ecb2fdcfd4c83b4a969c364c9 to your computer and use it in GitHub Desktop.
AccountDetails accountDetails = new AccountDetails();
CompletableFuture.allOf(
CompletableFuture.
supplyAsync(() -> //CALL MORTAGE INFO REST, executor).
thenAccept(x -> {
accountDetails.setMortgageAccountId(x.getReqdField())
}).
handle(//HANDLE GRACEFULLY),
CompletableFuture.
supplyAsync(() -> //CALL SOME OTHER REST, executor).
thenAccept(x -> {
accountDetails.setNoOfTrans(x.getReqdField())
}).
handle(//HANDLE GRACEFULLY),
CompletableFuture.
supplyAsync(() -> //CALL SOME INFO REST, executor).
thenAccept(x -> {
accountDetails.setAddressLine(x.getReqdField())
}).
handle(//HANDLE GRACEFULLY),
CompletableFuture.
supplyAsync(() -> //CALL SOME OTHER REST, executor).
thenAccept(x -> {
accountDetails.setExternalLink(x.getReqdField())
}).
handle(//HANDLE GRACEFULLY),
).join();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment