(Also see [remarkable][], the markdown parser created by the author of this cheatsheet)
public String getLogoInforme() { | |
return FacesContext.getCurrentInstance().getExternalContext().getRealPath("") + "/resources/imagenes/" + "vinclesweb_logo.png"; | |
} |
A collective list of free APIs for use in software and web development.
Sponsor:
A public API for this project can be found here - thanks to DigitalOcean for helping us provide this service!
Rx is based around two fundamental types, while several others expand the functionality around the core types. Those two core types are the Observable
and the Observer
, which will be introduced in this chapter. We will also introduce Subject
s, which ease the learning curve.
Rx builds upon the Observer pattern. It is not unique in doing so. Event handling already exists in Java (e.g. JavaFX's EventHandler). Those are simpler approaches, which suffer in comparison to Rx:
- Events through event handlers are hard to compose.
- They cannot be queried over time
- They can lead to memory leaks
- These is no standard way of signaling completion.
The idea behind Rx is that it is unknown when a sequence emits values or terminates, but you still have control over when you begin and stop accepting values. Subscriptions may be linked to allocated resources that you will want to release at the end of a sequence. Rx provides control over your subscriptions to enable you to do that.
There are several overloads to Observable.subscribe
, which are shorthands for the same thing.
Subscription subscribe()
Users expect real time data. They want their tweets now. Their order confirmed now. They need prices accurate as of now. Their online games need to be responsive. As a developer, you demand fire-and-forget messaging. You don't want to be blocked waiting for a result. You want to have the result pushed to you when it is ready. Even better, when working with result sets, you want to receive individual results as they are ready. You do not want to wait for the entire set to be processed before you see the first row. The world has moved to push; users are waiting for us to catch up. Developers have tools to push data, this is easy. Developers need tools to react to push data
Welcome to Rx. This book is based on Rx.NET's www.introtorx.com and it introduces beginners to RxJava, the Netflix implementation of the original Microsoft library. Rx is a powerful tool that enables the solutio
package learnrxjava.examples; | |
import java.util.concurrent.TimeUnit; | |
import rx.Observable; | |
import rx.Observable.OnSubscribe; | |
import rx.Subscriber; | |
import rx.schedulers.Schedulers; | |
public class HelloWorld { |
package com.reactive; | |
import java.io.Serializable; | |
import java.util.ArrayList; | |
import java.util.List; | |
import javax.enterprise.context.RequestScoped; | |
import javax.inject.Named; | |
import rx.Observable; | |
import rx.Subscriber; |
Getting started:
Related tutorials: