This is the 4th release of Reactor 3.1, part of BISMUTH-SR6 Release Train.
This is a recommended update for all Reactor 3 users.
⚠️ Update considerations and deprecations
- The MPSC
Queueimplementation from3.1.3.RELEASEshouldn't have been public (#1010, #1035)- it is now exposed as a plain
QueuethroughQueues.unboundedMultiproducer()
- it is now exposed as a plain
- 3 operator implementations have mistakenly been released as public classes (#1036)
- These classes shouldn't have normally been noticed by users. However they have now been made private.
FluxDelaySequence,FluxIndexandFluxIndexFuseable
- Emitting a
Contextas part ofFlux.repeatWhenandFlux.retryWhencompanion flux triggers a specific behavior (#1048)- The emitted
Context, which acts as a trigger for resubscription to the source, replaces the originalContextof the
xxxWhen operator and becomes visible to the upstream from that point. - Care should be taken to craft that
Contextfrom the originalContext, otherwise you risk blindly deleting keys from the original that 3rd party libraries rely on. (this is described in the javadoc)
- The emitted
- Like
Flux.zip,Mono.zipshort-circuits on the first source that terminates empty, cancelling other pending sources (#1071)- this means that the Mono will complete as soon as any
Mono<Void>source or any emptyMono<T>completes. this could lead to earlier than expected completions. - note this changes nothing for sources that are all valued
- You should look for
Mono.zip(...).then()pattern in your code and replace that withMono.when(...)instead, aswhendoes wait for all completions and results in aMono<Void>. - If you want to keep the behavior of letting all valid sources run to completion, use
Mono.zipDelayError, which
won't cancel other sources (aggregating to a compositeonErrorin case of 1+ errors, or an empty mono in case
of 0 error and 1+ empty sources)
- this means that the Mono will complete as soon as any
✨ New features and improvements
lognow has a variant that directly takes aLoggerinstance, which can improve performance if the bottleneck
is the resolution of Loggers (#956)- a new variant of merge, the
mergeOrdered, has been added toFluxandParallelFlux(#963) Flux.concatWithValues(T...)andMono.thenReturn(T)have been added to conveniently concat/continue with
scalar values (#1029)- Operators that used to synchronize around a queue now use the new MPSC queue implementation instead (#914)
distinctnow allows for arbitrary backing store, not necessarily aCollection, if you also provide a
"distinct check"BiPredicate(#1054)- In Kotlin extensions, nullable types are mapped to non-nullable Monos (#1062)
- Emitting a
Contextas part ofFlux.repeatWhenandFlux.retryWhencompanion flux triggers a specific behavior (see update considerations above, #1048) - Core implementations of
SchedulerandWorkerare nowScannable(#1050)- The interfaces themselves are not, so you'll need to attempt scanning by first calling
Scannable.from(schedulerInstance) ExecutorService-backed schedulers can offer a degree of insight into their executor if it is aThreadPoolExecutor, via
scanning ofCAPACITYandBUFFERED- Most core executors that used to be backed by a
Executors.newSingleThreadExecutor(which isn't introspectable by the above
method) are now backed by aThreadPoolExecutorwith acorePoolSize==maxPoolSizeof1.
- The interfaces themselves are not, so you'll need to attempt scanning by first calling
- Most operators that take a
Scheduleras parameter can return thatScheduleror theWorkerthey use via ascan()
of the newAttr.RUN_ONattribute. AScannable.UNAVAILABLE_SCANis returned if that information is not available (dcc36e5)
🪲 Bug fixes
doOnEachcould be ignored in case of aFuseablesource, due to a mistake in the way it would call its
downstreamonSubscribemethod with its source rather than itself (#1056, #1067)- The
elasticSchedulerwould retain a reference to all its expired workers, which has now been fixed (#1070) - The
TopicProcessorandWorkQueueProcessorforceShutdown()method would fail to shut down the "request task"
backingExecutorService(#1074) - Like
Flux.zip,Mono.zipshort-circuits on the first source that terminates empty, cancelling other pending sources
(see update considerations above, #1071)
📖 Documentation, Tests and Build
- Documentation improvements and typo corrections
- Various test improvements making some tests less brittle on our CI
japicmpnow has the previous 3.1.3.RELEASE as baseline (1c0fa6d)- Some tests were missing a final
verify()call, and as such not testing anything (#1046)