Functional Reactive Programming with RxJava • Ben Christensen • GOTO 2013

GOTO Conferences · 54K views · 2014 · 49:27

Open on YouTube

Functional programmingSoftware architecture & designDistributed systemstalkdated

Why Stack Overflow recommends it

Stack Overflow users link it as an introduction to RxJava and reactive programming when answering questions about asynchronous Java, Futures and ordered concurrent results.

Recommended by 2 people across 2 different months, 2016 to 2016.

What it is

A GOTO Aarhus 2013 conference talk by Ben Christensen of Netflix on functional reactive programming with RxJava. It shows how the Netflix API composes asynchronous data sources declaratively, avoiding blocking, synchronization and thread-safety problems, with real-world examples.

What people said

Recommends Emanuel Moecklin · 2016-03 · Stack Overflow · on “Wrapping an asynchronous computation into a synchronous (blocking) computation”

BTW if you have to do this in may places I'd consider using this: [LINK] ReactiveX is a perfect match for your problem although it has a steep learning curve (at least for me). This is a great introduction: [this video]

Recommends diduknow · 2016-04 · Stack Overflow · on “Multithreaded execution where order of finished Work Items is preserved”

Reactive programming could help. During my brief experience with RxJava I found it to be intuitive and easy to work with than core language features like Future etc. Your mileage may vary. Here are some helpful starting points [this video] The attached example also shows how this could be done. In the example below we have Packet's which need to be processed. They are taken through a simple trasnformation and fnally merged into one list. The output appended to this message shows that the Packets are received and transformed at different points in time but in the end they are output in the order they have been received import static java.time.Instant.now; import static rx.schedulers.Schedulers.io;

Cites Malt · 2016-02 · Stack Overflow · on “Difference between CompletableFuture, Future and RxJava's Observable”

Futures Futures [LINK] were introduced in Java 5 (2004). They're basically placeholders for a result of an operation that hasn't finished yet. Once the operation finishes, the Future will contain that result. For example, an operation can be a Runnable [LINK] or Callable [LINK] instance that is submitted to an ExecutorService [LINK] . The submitter of the operation can use the Future object to check whether the operation isDone() [LINK] , or wait for it to finish using the blocking get() [LINK] method. Example: /** * A task that sleeps for a second, then returns 1 **/ public static class MyCallable implements Callable<Integer> { @Override public Integer call() throws Exception { Thread.sleep