Skip to content

v.0.3.0

Compare
Choose a tag to compare
@zakgof zakgof released this 16 Jan 12:35
· 39 commits to master since this release

CompletableFuture compatibility

Added two new ActorRef ask methods returning CompletableFuture:

<R> CompletableFuture<R> ask(Function<T, R> action);
<R> CompletableFuture<R> ask(BiConsumer<T, Consumer<R>> action);

These methods pass the actor call result to the CompletableFuture returned from the method. In case of exception occuring during actor call, the exception is also passed to the CompletableFuture (the actor's exception handler is not triggered in that case).

Users are now able to process exceptions coming from actor calls:

primeNumberDetectorActor.askAnsweringFuture(primeNumberDetector -> primeNumberDetector.isNumberPrime(5))
    .thenApply(isPrime -> System.out.println("5 is prime? "+isPrime))
    .exceptionally(ex -> ex.printStackTrace());