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) UnicastProcessorwon't ignore theoverflowStrategyif we can detect that a bounded queue is used. By default, an unbounded queue is used and the strategy is silently ignored. (#612)QueueSupplierhas been renamed toQueuesand is now purely about queue-related utils and static suppliers. It doesn't implementSupplier<Queue>itself anymore. (#733)Hooksare now cumulative. Setting a hook will add it on top of the existing one(s) and you need toresetthe hook if you want to replace the current one. (#687)Flux.errorandMono.errorare nowScalarCallableand 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)
delayUntilOtherhas been removed (use a lambda ignoring the left-hand side instead)delayUntilDelayErrorhas been removed (in flux concatMap can be used to achieve similar delayError effect; in mono, delay error doesn't really make sense)MonoSourceandFluxSourceare now package private, superseded byMonoOperatorandFluxOperator.Scannableattributes are now regrouped back into a single generic classAttr<T>. This is a quasi-enumeration exposing constants rather than enums. (#728)- 🐞
LARGE_BUFFEREDhas a default of0in this version instead ofnullin 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 newStrictSubscriberenforces RS rules more strictly when going out of the Reactor world and bridging to an externalPublisher(#711) - ✨ Associating a
Contextto a reactive sequence ✨ (FluxorMono) 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-specificSubscribercommon 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
contextStartoperator (wich takes aFunction<Context, Context>). In order to access it in the data path, thecontextGetoperator has been added. It takes aBiFunction<T, Context, R>, allowing to transform the data depending on theContext. - There is a static factory method
Mono#currentContextthat can be used to emit theContextinitialized 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
distinctUntilChangedvariant with a bipredicate to evaluate if there is a change (#608) - Added a
onBackpressureBuffervariant with a TTL (#296) - Added an optional configurable default timeout on
StepVerifier#verify()(#651) - Added expect|verifyErrorSatisfies StepVerifier error expectations (#670)
Fluxnow also has thedelayUntiloperator (#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-corerepo and artifacts
🪲 Bug fixes
StepVerifiernow ignores empty multivalue expectations, which could previously lead to bad assertions (#650)- Fixed a bug were macro-fusion of
Flux#thenandMono#thenwould use arrays of incompatible types, resulting in anArrayStoreException(#661) - When a
doOnNextcallback would fail, when fused it wouldn't be caught by adoOnError(#664) filterWhenhad a bug in tracking request and produced amount, resulting in under-requesting hangs (#689, #692)MonoProcessorcould unnecessarily retain references to objects from its source. This is fixed by nulling out thesourceupon 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)scanaccumulation 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
refCntwith grace period doesn't forget subscribers when terminated, yet still reconnects. This was due to bad recycling inpublish/replay. (#675) - In
Flux.create, setting anonDisposecallback on theSinkafter itsonRequestmethod 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