I would like to know the difference between
CompletableFuture
,Future
and Observable
RxJava
.
What I know is all a
All three interfaces serve to transfer values from producer to consumer. Consumers can be of 2 kinds:
Also, communication interfaces differ in other ways:
As a result:
Future
transferes single value using synchronous interface
CompletableFuture
transferes single value using both synchronous and asynchronous interfaces
Rx
transferes multiple values using asynchronous interface with backpressure
Also, all these communication facilities support transferring exceptions. This is not always the case. For example, BlockingQueue
does not.