io.apptik.rxhub.AbstractRxHub Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of core Show documentation
Show all versions of core Show documentation
RxJava based Event Hub connecting Publishers and Subscribers
The newest version!
package io.apptik.rxhub;
import com.jakewharton.rxrelay.BehaviorRelay;
import com.jakewharton.rxrelay.PublishRelay;
import com.jakewharton.rxrelay.Relay;
import com.jakewharton.rxrelay.ReplayRelay;
import com.jakewharton.rxrelay.SerializedRelay;
import java.util.Locale;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import rx.Observable;
import rx.Observer;
import rx.Subscription;
import rx.functions.Action1;
import rx.functions.Func1;
import rx.subjects.BehaviorSubject;
import rx.subjects.PublishSubject;
import rx.subjects.ReplaySubject;
import rx.subjects.SerializedSubject;
import rx.subjects.Subject;
import rx.subscriptions.CompositeSubscription;
/**
* Base implementation of {@link RxHub}
* Essentially this is a collection of {@link Observable} nodes which can also subscribe to other
* Observables and pass events to their Subscribers
*
* Nodes can be either {@link Subject} or {@link Relay}. Nodes are identified by their Tags.
* Nodes subscribes to Observables however each subscription created is
* per {@link io.apptik.rxhub.RxHub.Source}. A Source is identified by Observable and a Tag.
* For example when Observable A is added with Tag T1 and Tag T2. Two nodes are created receiving
* the same events. Each of those nodes can be used and unsubscribed from Observable A
* independently.
*
* Observers subscribe to a Node. Observers does not need to know about the source of the Events
* i.e the Observers that the Nodes is subscribed to.
*
* To fetch the Node to subscribe to {@link AbstractRxHub#getNode(Object)} must be called.
*
* Non-Rx code can also call {@link AbstractRxHub#emit(Object, Object)} to manually emit Events
* through specific Node.
*/
public abstract class AbstractRxHub implements RxHub {
private final Map
© 2015 - 2025 Weber Informatics LLC | Privacy Policy