Closed andob closed 4 years ago
Thanks for your suggestion! Actor model common philosophy used to be 'let it crash', but I've always felt that ignoring errors is not sufficient enough. _Ask_ing with CompletableFuture looks very natural. Actually I'm thinking of revising the whole error handling in actr, but I'd like to avoid complexity and turning actr into another all-in-one reactive stream framework.
I'd like to avoid complexity and turning actr into another all-in-one reactive stream framework.
Agree :D
I think it would be nice to let the vanilla ask
behavior untouched. And to have separate integration modules, eg:
compile 'com.github.zakgof:actr:0.2.1'
//actor.askAnsweringFuture() -> Future<T>
compile 'com.github.zakgof:actr-futures:0.2.1'
//actor.askAnsweringRxObservable() -> Observable<T> - for RxJava
compile 'com.github.zakgof:actr-rx:0.2.1'
//and so on...
compile 'com.github.zakgof:actr-other-integration:0.2.1'
Just added the CompletableFuture API to ActorRef
. Released as v.0.3.0
First of all, thanks for creating this library. It's great because it's simple (I like simplicity) and TypeSafe (I took a look at akka, but didn't like it so much because its weak typeness). I'm going to use actr in an upcoming project.
I think it would be great to have future compatibility, for instance:
If I want to handle success / error states, I have to wrap the action in try - catch:
It would be nice to have this wrapping done automatically by the library, and to be able to use futures to handle success / error cases.
In the following example, I'm proposing a method with the following signature:
Usage:
Since I'm going to use Kotlin, I already made a similar extension method. But since Java doesn't have extension methods, I think this would be a nice feature.