Monix: Version 3.0.0-RC4

Last release before 3.0.0 which will be released as soon as Cats-Effect 2.0.0 is available. At the time of writing release notes, it is only waiting on Cats 2.0.0 which is about to release next RC which will become stable version if no critical issues are discovered.

Any other development for this release is now frozen except if we discover critical bugs like memory leaks. All other changes will target 3.1.0.

3.0.0 will be binary and source compatible with 3.0.0-RC4 for Scala 2.12. Monix itself will be also binary compatible for 2.11 but it will have a dependency on Cats-Effect which is not. See Cats-Effect release notes for more details.

We wish we could release 3.0.0 already but if we released now, we would have to release 4.0.0 for Cats-Effect 2.0 because of 2.11 incompatibility there so we decided to hold on. It was a rough road but currently we have multiple active maintainers that can do releases going forward, instead of just Alex so we hope it can give you a confidence for the future! :) Note that Cats-Effect 2.0 is very small release and mostly targeted at support for Scala 2.13 and bug fixes - the upgrade should be limited to bumping version without changing a single line of code.

This release depends on Cats-Effect 1.4.0 and Cats 1.6.1

This release is binary compatible with 3.0.0-RC3 on Scala 2.12. On Scala 2.11 there is an incompatibility caused by introduction of Scheduler.features:

exclude[ReversedMissingMethodProblem]("monix.execution.Scheduler.features")

Upgrading #

To use the new version, include this in your build.sbt:

libraryDependencies += "io.monix" %% "monix" % "3.0.0-RC4"

Changes #

Local #

There are several fixes related to Local usage.

  • Using TracingScheduler will also automatically enable local context propagation in Task so running it with runToFutureOpt or setting env variable is no longer a necessity.
  • Local.isolate has a overload for isolating Future which is safer than regular Local.isolate.

The Local model since 3.0.0-RC3 shares by default. To isolate modifications of Local by other concurrently running Future, you have to call Local.isolate.

In case of Task, there is a TaskLocal.isolate version. It is automatically called whenever you run Task so if your use case is setting correlationId or similar, it probably won’t require any explicit isolation because your HTTP library will most likely run the Task per request.

Task Builders #

There are two major improvements:

  • Now all Task builders (Task.create, Task.async, Task.fromFuture etc.) will return a Task that continues on default Scheduler which is the one supplied during execution unless overriden by executeOn.
  • Callback in Task.create is now thread-safe against contract violation (calling it more than once) so does not require synchronization on the user side.

Sub-project: monix-execution #

  • PR #946: Expose less implementation details in Local

  • PR #948: Make Task.memoize play well with Local

  • PR #953: Make default scheduler remove cancelled tasks

  • PR #960: Scheduler.features

  • PR #971: Callback tryOnSuccess/tryOnFailure

  • PR #973: Fix Local.isolate corner case

  • PR #977: Use type classes instead of overloads in Local.isolate/bind

Sub-project: monix-eval #

  • PR #913: Optimize Task.guarantee

  • PR #921 & PR #917: Callbacks in Task.create are now thread-safe and always return to the main Scheduler.

  • PR #933: Adds » syntax to Task

  • PR #935: Adds » syntax to Coeval

  • PR #934: Implement doOnFinish in terms of guaranteeCase

  • PR #951: Add void to Task + Coeval

  • PR #952: Implement ContextShift.evalOn in terms of Task.executeOn

  • PR #954: Add gatherN + wanderN

  • PR #972: Rename Task.forkAndForget to Task.startAndForget

Sub-project: monix-reactive #

  • PR #906: Fix race in MapParallelOrderedObservable

  • PR #918: switchMap should wait for last child to complete

  • PR #919: propagate cancellation to tasks in async Consumers

  • PR #932: Remove try-catch for EvalOnceObservable implementation

  • PR #941: Added some polymorphic methods for Observable

  • PR #945: Add collectWhile observable

  • PR #958: Add Observable.throttle

  • PR #963: Added fromAsyncStateActionF

  • PR #970: Observable.unfold

  • PR #989: Observable.unfoldEval and Observable.unfoldEvalF

Sub-project: monix-tail #

  • PR #965: fixes resource handling in Iterant.repeat, adds Iterant.retryIfEmpty

Chores #

  • PR #936: Add defaults values for benchmarking

  • Tons of updates by https://github.com/fthomas/scala-steward

Thanks #

People that made this release possible, in alphabetical order:

  • Alexandru Nedelcu (@alexandru)
  • Allan Timothy Leong (@allantl)
  • BambooTuna (@BambooTuna)
  • Carlo (@entangled90)
  • Oleg Pyzhcov (@oleg-py)
  • Paul K (@pk044)
  • Piotr Gawryś (@Avasil)
  • Rahil Bohra (@rahilb)
  • Richard Tarczaly (@arlequin-nyc)
  • Ryo Fukumuro (@rfkm)
  • TapanVaishnav (@TapanVaishnav)
  • Valentin Willscher (@valenterry)