Skip to content

v3.1.0.M3

Pre-release
Pre-release
Compare
Choose a tag to compare
@smaldini smaldini released this 18 Jul 04:29

This is the MILESTONE 3 release of Reactor 3.1, part of Bismuth-M3 Release Train.

This is a recommended update for all Reactor 3 users.

⚠️ Update considerations and deprecations

  • Nullability checks are helped with the use of annotations. Most of the Reactor API is NonNull (#614)
    • some additional non-null checks are enforced, notably on all Tuple (#696)
  • Processor builders: The move to builders from M2 has been partially reverted. Only Processors that are costly to instantiate have a Builder (TopicProcessor, WorkQueueProcessor). They also keep a couple of significant factory methods (#616)
  • UnicastProcessor won't ignore the overflowStrategy if we can detect that a bounded queue is used. By default, an unbounded queue is used and the strategy is silently ignored. (#612)
  • QueueSupplier has been renamed to Queues and is now purely about queue-related utils and static suppliers. It doesn't implement Supplier<Queue> itself anymore. (#733)
  • Hooks are now cumulative. Setting a hook will add it on top of the existing one(s) and you need to reset the hook if you want to replace the current one. (#687)
  • Flux.error and Mono.error are now ScalarCallable and the error case can be fused when source is scalar (#716)
  • Some methods deprecated in M2 have been removed (see #323)
    • part of the factory methods of TopicProcessor and WorkQueueProcessor (the simpler processors have had their factory methods un-deprecated) (#471, #616)
    • untilOther, which is replaced by the more useful delayUntil (use a lambda ignoring the left-hand side if necessary) (#558)
    • zip(Function, Iterable) (#619)
  • delayUntilOther has been removed (use a lambda ignoring the left-hand side instead)
  • delayUntilDelayError has been removed (in flux concatMap can be used to achieve similar delayError effect; in mono, delay error doesn't really make sense)
  • MonoSource and FluxSource are now package private, superseded by MonoOperator and FluxOperator.
  • Scannable attributes are now regrouped back into a single generic class Attr<T>. This is a quasi-enumeration exposing constants rather than enums. (#728)
    • 🐞 LARGE_BUFFERED has a default of 0 in this version instead of null in M2, but that is a mistake that will be fixed in RC1 (see #751)
  • Reactor has been updated to pass the TCK of the new Reactive Streams specification 1.0.1.RC2. A new StrictSubscriber enforces RS rules more strictly when going out of the Reactor world and bridging to an external Publisher (#711)
  • Associating a Context to a reactive sequence ✨ (Flux or Mono) is now possible. This is the major new feature in this milestone. (#117, #210, #337, #447, #704, #705, #723 and various other PRs)
    • Added CoreSubscriber, a Reactor-specific Subscriber common to all Flux and Mono operators and needed to pass along the Context
    • Flux#subscribe(Subscriber) is now final, and one needs to instead implement subscribe(CoreSubscriber) in custom operators / Flux.
    • the context is enriched during the subscription phase, possibly via the contextStart operator (wich takes a Function<Context, Context>). In order to access it in the data path, the contextGet operator has been added. It takes a BiFunction<T, Context, R>, allowing to transform the data depending on the Context.
    • There is a static factory method Mono#currentContext that can be used to emit the Context initialized downstream of it (or propagated inside eg. a flatMap)
    • Context propagation and initialization is only done during the subscription phase, in reverse order of the chain of operators.

✨ New features and improvements

  • Null analysis has been enabled through the use of Nullable/NonNullApi annotations (#614)
  • Reduce WorkQueueProcessor/TopicProcessor sink serialization when it is not necessary (#630, #727)
  • Added a distinctUntilChanged variant with a bipredicate to evaluate if there is a change (#608)
  • Added a onBackpressureBuffer variant with a TTL (#296)
  • Added an optional configurable default timeout on StepVerifier#verify() (#651)
  • Added expect|verifyErrorSatisfies StepVerifier error expectations (#670)
  • Flux now also has the delayUntil operator (#674)
  • A new global hook has been added: Hooks.onNewSubscriber
  • When using Mono.fromRunnable, the resulting Mono's generic type is better inferred (#686)
  • Assembly tracking internals have been improved, allowing to cache assembly stacktrace notably (#712)
  • Kotlin extensions for core and test are now part of the reactor-core repo and artifacts

🪲 Bug fixes

  • StepVerifier now ignores empty multivalue expectations, which could previously lead to bad assertions (#650)
  • Fixed a bug were macro-fusion of Flux#then and Mono#then would use arrays of incompatible types, resulting in an ArrayStoreException (#661)
  • When a doOnNext callback would fail, when fused it wouldn't be caught by a doOnError (#664)
  • filterWhen had a bug in tracking request and produced amount, resulting in under-requesting hangs (#689, #692)
  • MonoProcessor could unnecessarily retain references to objects from its source. This is fixed by nulling out the source upon all terminations (#690)
  • MonoProcessor#block() had a legacy inner timeout. It will now indefinitely wait for the actual completion. On the other hand, using a negative or 0 timeout in the Duration-based variant will now immediately time out. (#722)
  • scan accumulation in a live reduction with a seed would always lag by one. It has been modified so that the seed is sent immediately, which allows the accumulator to run in lockstep with the upstream stage. (#609)
  • Fixed an issue where refCnt with grace period doesn't forget subscribers when terminated, yet still reconnects. This was due to bad recycling in publish/replay. (#675)
  • In Flux.create, setting an onDispose callback on the Sink after its onRequest method was called was ignored. The callback is now explicitly invoked if set after the sink was terminated. (#643)

📖 Documentation, Tests and Build

  • Added tests and docs for multi-threaded producer with Processor sink, thread affinity using publishOn (#469, #521, #698)
  • fix JMH IntelliJ integration: back to plugin, not imported as src scope
  • Travis CI build script: only test reactor-test if all changes are in reactor-test/
  • Fixed title of reactor-test javadoc + fix links to core (#644)
  • Made javadoc external links slightly stand out
  • Improved wording on several javadoc items and reference guide subsections

👍 Thanks to the following contributors that also participated to this release

@IlyaZinkovich, @markotron, @osi, @rajinisivaram, @sdeleuze