Trait/Object

monix.reactive

Consumer

Related Docs: object Consumer | package reactive

Permalink

trait Consumer[-In, +R] extends (Observable[In]) ⇒ Task[R] with Serializable

The Consumer is a specification of how to consume an observable.

It is a factory of subscribers with a completion callback attached, being effectively a way to transform observables into tasks for less error prone consuming of streams.

Self Type
Consumer[In, R]
Source
Consumer.scala
Linear Supertypes
Serializable, Serializable, (Observable[In]) ⇒ Task[R], AnyRef, Any
Known Subclasses
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. Consumer
  2. Serializable
  3. Serializable
  4. Function1
  5. AnyRef
  6. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Abstract Value Members

  1. abstract def createSubscriber(cb: Callback[R], s: Scheduler): (Subscriber[In], AssignableCancelable)

    Permalink

    Builds a new Subscriber that can be subscribed to an Observable for consuming a stream, with a callback that should eventually get called with a materialized result.

    Builds a new Subscriber that can be subscribed to an Observable for consuming a stream, with a callback that should eventually get called with a materialized result.

    Notes:

    • calling the callback must obey the contract for the Callback type
    • the given callback should always get called, unless the upstream gets canceled
    • the given callback can be called when the subscriber is finished processing, but not necessarily
    • if the given callback isn't called after the subscriber is done processing, then the Task returned by apply loses the ability to cancel the stream, as that Task will complete before the stream is finished
    cb

    is the Callback that will get called once the created subscriber is finished.

    s

    is the Scheduler that will get used for subscribing to the source observable and to process the events.

    returns

    a new subscriber that can be used to consume observables.

Concrete Value Members

  1. final def !=(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  4. def andThen[A](g: (Task[R]) ⇒ A): (Observable[In]) ⇒ A

    Permalink
    Definition Classes
    Function1
    Annotations
    @unspecialized()
  5. def apply(source: Observable[In]): Task[R]

    Permalink

    Given a source Observable, convert it into a Task by piggybacking on createSubscriber.

    Given a source Observable, convert it into a Task by piggybacking on createSubscriber.

    Definition Classes
    Consumer → Function1
  6. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  7. def clone(): AnyRef

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  8. def compose[A](g: (A) ⇒ Observable[In]): (A) ⇒ Task[R]

    Permalink
    Definition Classes
    Function1
    Annotations
    @unspecialized()
  9. def contramap[In2](f: (In2) ⇒ In): Consumer[In2, R]

    Permalink

    Given a contravariant mapping function, transform the source consumer by transforming the input.

  10. final def eq(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  11. def equals(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  12. def finalize(): Unit

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  13. final def getClass(): Class[_]

    Permalink
    Definition Classes
    AnyRef → Any
  14. def hashCode(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  15. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  16. def map[R2](f: (R) ⇒ R2): Consumer[In, R2]

    Permalink

    Given a mapping function, when consuming a stream, applies the mapping function to the final result, thus modifying the output of the source consumer.

    Given a mapping function, when consuming a stream, applies the mapping function to the final result, thus modifying the output of the source consumer.

    Note that for applying the mapping function an asynchronous boundary is forced, otherwise it could trigger a stack overflow exception. For more efficient mapping of the result, it's probably better to map the resulting Task on Observable.runWith.

    See also

    mapAsync for a variant that can map the output to a Task that can be processed asynchronously.

  17. def mapAsync[R2](f: (R) ⇒ Task[R2]): Consumer[In, R2]

    Permalink

    Given a mapping function, when consuming a stream, applies the mapping function to the final result, thus modifying the output of the source consumer.

    Given a mapping function, when consuming a stream, applies the mapping function to the final result, thus modifying the output of the source consumer.

    The mapping function returns a Task that can be used to process results asynchronously.

    Note that for applying the mapping function an asynchronous boundary is forced, otherwise it could trigger a stack overflow exception. For more efficient mapping of the result, it's probably better to map the resulting Task on Observable.runWith.

  18. final def ne(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  19. final def notify(): Unit

    Permalink
    Definition Classes
    AnyRef
  20. final def notifyAll(): Unit

    Permalink
    Definition Classes
    AnyRef
  21. final def synchronized[T0](arg0: ⇒ T0): T0

    Permalink
    Definition Classes
    AnyRef
  22. def toString(): String

    Permalink
    Definition Classes
    Function1 → AnyRef → Any
  23. final def wait(): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  24. final def wait(arg0: Long, arg1: Int): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  25. final def wait(arg0: Long): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Inherited from Serializable

Inherited from Serializable

Inherited from (Observable[In]) ⇒ Task[R]

Inherited from AnyRef

Inherited from Any

Ungrouped