This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { // Emulating a failed call to the external service | |
| Thread.sleep(2000); | |
| getSender().tell( | |
| new InteractionProtocol.UnavailableClubDetails("timed out"), | |
| getSelf() | |
| ); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| if (clubID == 0) { // A forced 'fail' timeout situation, for demonstration | |
| PatternsCS | |
| .pipe( | |
| circuitBreaker.callWithCircuitBreakerCS(nonWorkingCallable), | |
| getContext().system().dispatcher() | |
| ) | |
| .to(getSender()); | |
| } | |
| else { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Callable <CompletionStage<ClubDetailsFromXternalSource>> workingCallable = | |
| new Callable<CompletionStage<ClubDetailsFromXternalSource>>() { | |
| @Override | |
| public CompletionStage<ClubDetailsFromXternalSource> call() throws Exception { | |
| return ( | |
| CompletableFuture.supplyAsync( | |
| new Supplier<ClubDetailsFromXternalSource>() { | |
| @Override | |
| public ClubDetailsFromXternalSource get() { | |
OlderNewer