
com.cookingfox.rxbus_eventbus.RxBusForwarder Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of rxbus-eventbus-java Show documentation
Show all versions of rxbus-eventbus-java Show documentation
A simple EventBus using RX Java
The newest version!
package com.cookingfox.rxbus_eventbus;
import rx.Observable;
import rx.Subscription;
import rx.functions.Action1;
import rx.functions.Func0;
import rx.functions.Func1;
/**
* Operations for forwarding observables to events. What this means is that when a provided 'source'
* observable emits a value, an 'event producer' is triggered that creates an event (with or
* without the emitted value), which is then emitted on the RxBus.
*/
public interface RxBusForwarder {
/**
* Subscribes to the source stream and, on a new value, produces an event using the provided
* producer and emits that event on the EventBus.
*
* @param source The source stream to subscribe to.
* @param eventProducer The function that creates an event, ignoring the emitted value of the
* source stream.
* @param Indicates the event type which the event producer creates.
* @return The subscription for the forwarding stream.
*/
Subscription forward(Observable> source, Func0 eventProducer);
/**
* Subscribes to the source stream and, on a new value, produces an event using the provided
* producer and emits that event on the EventBus.
*
* @param source The source stream to subscribe to.
* @param eventProducer The function that creates an event, ignoring the emitted value of the
* source stream.
* @param onError The action you have designed to accept any error notification from the
* Observable.
* @param Indicates the event type which the event producer creates.
* @return The subscription for the forwarding stream.
*/
Subscription forward(Observable> source, Func0 eventProducer, Action1 onError);
/**
* Subscribes to the source stream and, on a new value, produces an event using the provided
* producer and emits that event on the EventBus.
*
* @param source The source stream to subscribe to.
* @param eventProducer The function that creates an event using the emitted value of the source
* stream.
* @param Indicates the type of value which the source stream emits.
* @param Indicates the event type which the event producer creates.
* @return The subscription for the forwarding stream.
*/
Subscription forward(Observable source, Func1 eventProducer);
/**
* Subscribes to the source stream and, on a new value, produces an event using the provided
* producer and emits that event on the EventBus.
*
* @param source The source stream to subscribe to.
* @param eventProducer The function that creates an event using the emitted value of the source
* stream.
* @param onError The action you have designed to accept any error notification from the
* Observable.
* @param Indicates the type of value which the source stream emits.
* @param Indicates the event type which the event producer creates.
* @return The subscription for the forwarding stream.
*/
Subscription forward(Observable source, Func1 eventProducer, Action1 onError);
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy