object Callback
- Source
- Callback.scala
- Alphabetic
- By Inheritance
- Callback
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Value Members
- def apply[E]: Builders[E]
For building Callback objects using the Partially-Applied Type technique.
For building Callback objects using the Partially-Applied Type technique.
For example these are Equivalent:
Callback[Throwable, Throwable].empty[String] <-> Callback.empty[Throwable, String] - def empty[E, A](implicit r: UncaughtExceptionReporter): Callback[E, A]
Creates an empty Callback, a callback that doesn't do anything in
onNextand that logs errors inonErrorwith the provided monix.execution.UncaughtExceptionReporter. - def forked[E, A](cb: Callback[E, A])(implicit ec: ExecutionContext): Callback[E, A]
Given a Callback wraps it into an implementation that calls
onSuccessandonErrorasynchronously, using the given scala.concurrent.ExecutionContext.Given a Callback wraps it into an implementation that calls
onSuccessandonErrorasynchronously, using the given scala.concurrent.ExecutionContext.The async boundary created is "light", in the sense that a TrampolinedRunnable is used and supporting schedulers can execute these using an internal trampoline, thus execution being faster and immediate, but still avoiding growing the call-stack and thus avoiding stack overflows.
THREAD-SAFETY: the returned callback is thread-safe.
In case
onSuccessandonErrorget called multiple times, from multiple threads even, the implementation protects against access violations and throws a CallbackCalledMultipleTimesException.- See also
- def fromAttempt[E, A](cb: (Either[E, A]) => Unit): Callback[E, A]
Turns
Either[Throwable, A] => Unitcallbacks into Monix callbacks.Turns
Either[Throwable, A] => Unitcallbacks into Monix callbacks.These are common within Cats' implementation, used for example in
cats.effect.IO.WARNING: the returned callback is NOT thread-safe!
- def fromPromise[A](p: Promise[A]): Callback[Throwable, A]
Returns a Callback instance that will complete the given promise.
Returns a Callback instance that will complete the given promise.
THREAD-SAFETY: the provided instance is thread-safe by virtue of
Promisebeing thread-safe. - def fromTry[A](cb: (Try[A]) => Unit): Callback[Throwable, A]
Turns
Try[A] => Unitcallbacks into Monix callbacks.Turns
Try[A] => Unitcallbacks into Monix callbacks.These are common within Scala's standard library implementation, due to usage with Scala's
Future.WARNING: the returned callback is NOT thread-safe!
- def safe[E, A](cb: Callback[E, A])(implicit r: UncaughtExceptionReporter): Callback[E, A]
Wraps any Callback into a safer implementation that protects against protocol violations (e.g.
Wraps any Callback into a safer implementation that protects against protocol violations (e.g.
onSuccessoronErrormust be called at most once).THREAD-SAFETY: the returned callback is thread-safe.
In case
onSuccessandonErrorget called multiple times, from multiple threads even, the implementation protects against access violations and throws a CallbackCalledMultipleTimesException. - def trampolined[E, A](cb: Callback[E, A])(implicit ec: ExecutionContext): Callback[E, A]
Given a Callback wraps it into an implementation that calls
onSuccessandonErrorasynchronously, using the given scala.concurrent.ExecutionContext.Given a Callback wraps it into an implementation that calls
onSuccessandonErrorasynchronously, using the given scala.concurrent.ExecutionContext.The async boundary created is "light", in the sense that a TrampolinedRunnable is used and supporting schedulers can execute these using an internal trampoline, thus execution being faster and immediate, but still avoiding growing the call-stack and thus avoiding stack overflows.
THREAD-SAFETY: the returned callback is thread-safe.
In case
onSuccessandonErrorget called multiple times, from multiple threads even, the implementation protects against access violations and throws a CallbackCalledMultipleTimesException.- See also

This is the API documentation for the Monix library.
Package Overview
monix.execution exposes lower level primitives for dealing with asynchronous execution:
Atomictypes, as alternative tojava.util.concurrent.atomicmonix.catnap exposes pure abstractions built on top of the Cats-Effect type classes:
monix.eval is for dealing with evaluation of results, thus exposing Task and Coeval.
monix.reactive exposes the
Observablepattern:Observableimplementationsmonix.tail exposes Iterant for purely functional pull based streaming:
BatchandBatchCursor, the alternatives to Scala'sIterableandIteratorrespectively that we are using within Iterant's encodingYou can control evaluation with type you choose - be it Task, Coeval, cats.effect.IO or your own as long as you provide correct cats-effect or cats typeclass instance.