RxStream

wvlet.airframe.rx.RxStream
trait RxStream[+A] extends Rx[A] with LogSupport

The base reactive stream interface that can receive events from upstream operators and chain next actions using Scala-collection like operators (e.g., map, filter, etc.)

Attributes

Graph
Supertypes
trait LogSupport
trait LazyLogger
trait LoggingMethods
trait Serializable
trait Rx[A]
class Object
trait Matchable
class Any
Known subtypes
class ConcatOp[A]
class Join3Op[A, B, C]
class Join4Op[A, B, C, D]
class JoinOp[A, B]
class LastOp[A]
class SeqOp[A]
class SingleOp[A]
class TakeOp[A]
class TimerOp
class TryOp[A]
class UnaryRx[I, A]
class CacheOp[A]
class FilterOp[A]
class FlatMapOp[A, B]
class MapOp[A, B]
class NamedOp[A]
class RecoverOp[A, U]
class RecoverWithOp[A, U]
class Zip3Op[A, B, C]
class Zip4Op[A, B, C, D]
class ZipOp[A, B]
trait RxSource[A]
trait RxStreamCache[A]
class RxVar[A]

Members list

Concise view

Value members

Concrete methods

def andThen[B](f: A => Future[B])(implicit ex: ExecutionContext): RxStream[B]

Combine Rx stream and Future operators.

Combine Rx stream and Future operators.

This method is useful when you need to call RPC multiple times and chain the next operation after receiving the response.

Rx.intervalMillis(1000)
 .andThen { i => callRpc(...) } // Returns Future
 .map { (rpcReturnValue) => ... } // Use the Future response

Attributes

def cache[A1 >: A]: RxStreamCache[A1]

Cache the last item, and emit the cached value if available.

Cache the last item, and emit the cached value if available.

The cached value will be preserved to the operator itself even after cancelling the subscription. Re-subscription of this operator will immediately return the cached value to the downstream operator.

This operator is useful if we need to involve time-consuming process, and want to reuse the last result: val v = Rx.intervalMillis(1000).map(i => (heavy process)).cache

v.map { x => ... }

Attributes

def concat[A1 >: A](other: Rx[A1]): RxStream[A1]
def filter(f: A => Boolean): RxStream[A]
def flatMap[B](f: A => Rx[B]): RxStream[B]
def join[B](other: Rx[B]): RxStream[(A, B)]

Emit a new output if one of Rx[A] or Rx[B] is changed.

Emit a new output if one of Rx[A] or Rx[B] is changed.

This method is useful when you need to monitor multiple Rx objects.

Using joins will be more intuitive than nesting multiple Rx operators like Rx[A].map { x => ... Rx[B].map { ...} }.

Attributes

def join[B, C](b: Rx[B], c: Rx[C]): RxStream[(A, B, C)]
def join[B, C, D](b: Rx[B], c: Rx[C], d: Rx[D]): RxStream[(A, B, C, D)]
def map[B](f: A => B): RxStream[B]
def sample(timeWindow: Long, unit: TimeUnit): RxStream[A]

Emit the most recent item of the source within periodic time intervals.

Emit the most recent item of the source within periodic time intervals.

Attributes

def startWith[A1 >: A](a: A1): RxStream[A1]

Emit the given item first before returning the items from the source.

Emit the given item first before returning the items from the source.

Attributes

def startWith[A1 >: A](lst: Seq[A1]): RxStream[A1]

Emit the given items first before returning the items from the source.

Emit the given items first before returning the items from the source.

Attributes

def take(n: Long): RxStream[A]

Take an event up to n elements. This may receive fewer events than n if the upstream operator completes before generating n elements.

Take an event up to n elements. This may receive fewer events than n if the upstream operator completes before generating n elements.

Attributes

def throttleFirst(timeWindow: Long, unit: TimeUnit): RxStream[A]

Emit the first item of the source within each sampling period. This is useful, for example, to prevent double-clicks of buttons.

Emit the first item of the source within each sampling period. This is useful, for example, to prevent double-clicks of buttons.

Attributes

def throttleLast(timeWindow: Long, unit: TimeUnit): RxStream[A]

Emit the most recent item of the source within periodic time intervals.

Emit the most recent item of the source within periodic time intervals.

Attributes

def toOption[X, A1 >: A](implicit ev: A1 <:< Option[X]): RxOption[X]
override def toRxStream: RxStream[A]

Attributes

Definition Classes
def withFilter(f: A => Boolean): RxStream[A]
def withName(name: String): RxStream[A]
def zip[B](other: Rx[B]): RxStream[(A, B)]

Combine two Rx streams to form a sequence of pairs. This will emit a new pair when both of the streams are updated.

Combine two Rx streams to form a sequence of pairs. This will emit a new pair when both of the streams are updated.

Attributes

def zip[B, C](b: Rx[B], c: Rx[C]): RxStream[(A, B, C)]
def zip[B, C, D](b: Rx[B], c: Rx[C], d: Rx[D]): RxStream[(A, B, C, D)]

Inherited methods

inline protected def debug(inline message: Any, inline cause: Throwable): Unit

Attributes

Inherited from:
LoggingMethods
inline protected def debug(inline message: Any): Unit

Attributes

Inherited from:
LoggingMethods
inline protected def error(inline message: Any, inline cause: Throwable): Unit

Attributes

Inherited from:
LoggingMethods
inline protected def error(inline message: Any): Unit

Attributes

Inherited from:
LoggingMethods
inline protected def info(inline message: Any, inline cause: Throwable): Unit

Attributes

Inherited from:
LoggingMethods
inline protected def info(inline message: Any): Unit

Attributes

Inherited from:
LoggingMethods
inline protected def logAt(inline logLevel: LogLevel, inline message: Any): Unit

Attributes

Inherited from:
LoggingMethods
def parents: Seq[Rx[_]]

Attributes

Inherited from:
Rx
def recover[U](f: PartialFunction[Throwable, U]): RxStream[U]

Recover from a known error and emit a replacement value

Recover from a known error and emit a replacement value

Attributes

Inherited from:
Rx
def recoverWith[A](f: PartialFunction[Throwable, Rx[A]]): RxStream[A]

Recover from a known error and emit replacement values from a given Rx

Recover from a known error and emit replacement values from a given Rx

Attributes

Inherited from:
Rx
def run[U](effect: A => U): Cancelable

Evaluate this Rx[A] and apply the given effect function. Once OnError(e) or OnCompletion is observed, it will stop the evaluation.

Evaluate this Rx[A] and apply the given effect function. Once OnError(e) or OnCompletion is observed, it will stop the evaluation.

Attributes

Inherited from:
Rx
def runContinuously[U](effect: A => U): Cancelable

Keep evaluating Rx[A] even if OnError(e) or OnCompletion is reported. This is useful for keep processing streams.

Keep evaluating Rx[A] even if OnError(e) or OnCompletion is reported. This is useful for keep processing streams.

Attributes

Inherited from:
Rx
def subscribe[U](subscriber: A => U): Cancelable

Attributes

Inherited from:
Rx
def toSeq: Seq[A]

Materialize the stream as Seq[A]. This works only for the finite stream and for Scala JVM.

Materialize the stream as Seq[A]. This works only for the finite stream and for Scala JVM.

Attributes

Inherited from:
Rx
inline protected def trace(inline message: Any, inline cause: Throwable): Unit

Attributes

Inherited from:
LoggingMethods
inline protected def trace(inline message: Any): Unit

Attributes

Inherited from:
LoggingMethods
inline protected def warn(inline message: Any, inline cause: Throwable): Unit

Attributes

Inherited from:
LoggingMethods
inline protected def warn(inline message: Any): Unit

Attributes

Inherited from:
LoggingMethods