v3.1.0.M3
Pre-release
Pre-release
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)
- some additional non-null checks are enforced, notably on all
- 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 theoverflowStrategy
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 toQueues
and is now purely about queue-related utils and static suppliers. It doesn't implementSupplier<Queue>
itself anymore. (#733)Hooks
are now cumulative. Setting a hook will add it on top of the existing one(s) and you need toreset
the hook if you want to replace the current one. (#687)Flux.error
andMono.error
are nowScalarCallable
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 usefuldelayUntil
(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
andFluxSource
are now package private, superseded byMonoOperator
andFluxOperator
.Scannable
attributes are now regrouped back into a single generic classAttr<T>
. This is a quasi-enumeration exposing constants rather than enums. (#728)- 🐞
LARGE_BUFFERED
has a default of0
in this version instead ofnull
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 newStrictSubscriber
enforces RS rules more strictly when going out of the Reactor world and bridging to an externalPublisher
(#711) - ✨ Associating a
Context
to a reactive sequence ✨ (Flux
orMono
) 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-specificSubscriber
common to all Flux and Mono operators and needed to pass along theContext
Flux#subscribe(Subscriber)
is nowfinal
, and one needs to instead implementsubscribe(CoreSubscriber)
in custom operators / Flux.- the context is enriched during the subscription phase, possibly via the
contextStart
operator (wich takes aFunction<Context, Context>
). In order to access it in the data path, thecontextGet
operator has been added. It takes aBiFunction<T, Context, R>
, allowing to transform the data depending on theContext
. - There is a static factory method
Mono#currentContext
that can be used to emit theContext
initialized downstream of it (or propagated inside eg. aflatMap
) - Context propagation and initialization is only done during the subscription phase, in reverse order of the chain of operators.
- Added
✨ 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 thedelayUntil
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
andMono#then
would use arrays of incompatible types, resulting in anArrayStoreException
(#661) - When a
doOnNext
callback would fail, when fused it wouldn't be caught by adoOnError
(#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 thesource
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 theDuration
-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 inpublish
/replay
. (#675) - In
Flux.create
, setting anonDispose
callback on theSink
after itsonRequest
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