v3.5.0
Reactor-Core 3.5.0 is part of 2022.0.0 Release Train.
This is the first GA release of 2022.0.0 π
This note focuses on 3.5.0 proper, curating changes from across all milestones and also includes changes already released as part of 3.4.x line up to 3.4.25.
While there are plenty of improvements and bug fixes, it's worth to highlight the bigger themes first:
- The
Monostack is now more lazy and complies to the Reactive Streams specification by only evaluating the sourcePublisherafter receiving appropriate demand. Previously this usually happened during subscription time. - We reworked the metrics utilities. Please consult the reference documentation for more details.
- A new context-propagation library has become an important part of the Reactor and Micrometer backbone to allow bridging between reactive and
ThreadLocalcontextual metadata. Reactor supports this bridging as soon as context-propagation library is present at runtime. Read more in the reference documentation.
Please pay special attention to the following update considerations. More detailed listing of features, bug fixes, and improvements follow.
β οΈ Update considerations and deprecations
β οΈ ποΈ Removals
- Remove Kotlin extensions by @simonbasle in #2949
- These now live in the reactor-kotlin-extensions library
- Remove deprecated
Mono.doOn/AfterSuccessOrErrorby @simonbasle in #2954- The
doOn*recommended alternatives includedoOnNext(Consumer),doOnError(Consumer),doOnTerminate(Runnable), anddoOnSuccess(Consumer), - The
doAfter*recommended alternatives aredoAfterTerminate(Runnable)anddoFinally(Consumer).
- The
- Remove deprecated context-related operators by @simonbasle in #2953
deferWithContext(Function)-> usedeferContextual(Function)instead,subscriberContext(Context)andsubscriberContext(Function)-> usecontextWrite(ContextView)andcontextWrite(Function)instead,Signal::getContext()-> useSignal::getContextView()instead,Context::putAll(Context)-> useContext::putAll(ContextView)instead.
- Remove deprecated
ElasticSchedulerby @simonbasle in #2955- Use
BoundedElasticScheduler(Schedulers.boundedElastic()) instead.
- Use
β οΈ β Deprecations
- Introduce new module
reactor-core-micrometerby @simonbasle in #3015- We introduced a new module,
reactor-core-micrometer, and added operators and features supporting the newObservationAPI of Micrometer 1.10.0, read more about it the release notes. - The class
reactor.util.Metrics,Flux::metrics()andMono::metrics()operators have been deprecated.
- We introduced a new module,
- Deprecate
[Flux|Mono|Synchronous]Sink currentContextby @simonbasle in #2974, #3021contextView()should be used instead.
- Deprecate scheduler start by @chemicL in #3236
Scheduler#init()method should be used instead. Restart capability is discouraged and the new method is allowed to throw in case of initializing a disposed instance. Please create a newSchedulerinstance when necessary.- Implementors of
Schedulershould also implement theinit()method, which currently delegates tostart()in the default implementation.
β οΈ β»οΈ Behavior Changes
- Make some
Monosources and aggregators lazier by @OlegDokuka in #3081 - Change behavior of
switchOnNext/switchMapdefault 0 prefetch by @simonbasle in #2956 - Have
concatMapdefault to 0 prefetch behavior by @simonbasle in #2967 take(n)now behaves astake(n,true)/limitRequestby @simonbasle in #2969SourceExceptionwrapper for main stream errors delivered to windows by @chemicL in #3167Scheduler.isDisposed()only true for disposed instances by @chemicL in #3243- adds cancellation of the source future support by @OlegDokuka in #3146
Scannable.tags()rework, addtagsDeduplicated()by @simonbasle in #3037- Disable fusion in
MonoSubscriberby @UgiR in #3245- A number of
Monooperators derived from theOperators.MonoSubscriberhave stopped negotiating fusion (even though theirPublisherstill implementsFuseable) - The highest impact is likely to be on tests that validate the fusion negotiation (eg.
StepVerifier'sexpectFusion(...))
- A number of
β¨ New features and improvements
Context propagation and bridging to ThreadLocals
- Add
context-propagation-apidependency +ReactorContextAccessorby @simonbasle in #3098, #3107, #3256 - Add
ContextPropagationruntime util +captureContextoperator by @simonbasle in #3145 handle/tapimplicitThreadLocalrestoration ifContextCaptureby @simonbasle in #3180- Add
forEachmethod toContextViewand subclasses by @chemicL in #3092 - Introducing default impl for
Context::forEachby @chemicL in #3101 - Introducing
Context::putAllMapby @chemicL in #3102
Observability and logging
- Introduce new module
reactor-core-micrometerby @simonbasle in #3015- Please consult the reference documentation for more details.
- Add
StateLoggerfor structured logging of state machines by @OlegDokuka in #3077 - Polish
Observationnames and tag keys by @simonbasle in #3110 Micrometer#observation(): avoids scopes, set parentObservation by @simonbasle in #3119- Add logging in
Exceptions.throwIf[Jvm]Fatal, addisFatalmethods by @simonbasle in #3122 - Only initialize logging once per test session by @marcphilipp in #3263
- Add
TimedSchedulertoreactor-core-micrometermodule by @simonbasle in #3109
Operators and relevant machinery
- Add 'tap', a generic side-effect/observability operator by @simonbasle in #3013
- Add
Flux.mergePriority, does not wait for all sources to emit by @osi in #3267 - Introduce an alternative to Processor-with-upstream case by @simonbasle in #3042, #3065
- Implement variant of
windowTimeoutwithfairBackpressureby @OlegDokuka in #3054 - Add windowTimeout sendNext early guard against maxSize overflow by @OlegDokuka in #3073
- Replay terminal signals to late subscribers in
Flux.replay(int)andFlux.cache(int)by @chemicL in #3200 - Add
disposeGracefullymethod toSchedulerby @chemicL in #3089 - Optimize
Schedulerinitialization by @chemicL in #3248 - Limit the number of
Scheduler#disposeGracefullythreads by @simonbasle in #3259 - Add key hook parts to
Schedulers.onHandleErrorby @simonbasle in #3039 - Use byte padding to avoid fields re-ordering on JDK 15 and above by @lantalex in #3168
- Make use of CompletionStage#handle instead of
whenCompleteby @He-Pin in #3221 - adds on discard support for
FluxZip/MonoZipby @OlegDokuka in #3209 - Include classname of null-returning
mapfunction in NPE msg by @ismailalammar in #2984
reactor-test module
- [reactor-test] Add
StepVerifieroption to useConditionalSubscriberby @simonbasle in #3035 - Implement disposing of tasks scheduled on
VirtualTimeSchedulerby @mdindoffer in #3097 - Ensure
StepVerifierevaluates signal that exitsthenConsumeWhileby @simonbasle in #3203 - Improve
LoggerUtilssupport and addTestLoggerExtensionby @simonbasle in #3123
π Bug fixes
- [agent] Avoid instrumenting methods with unwrappable returnType by @simonbasle in #2973
- Avoid
FluxReplaybuffer retaining/leaking with tiny TTL by @simonbasle in #2998 - Fix subscribers being retained by
SinkOneMulticastby @simonbasle in #3002 - Fix a
Manysink /EmitterProcessorsubscriber disposal leak by @simonbasle in #3029 - Fix
doOnEachASYNC fusion triggeringonNextsignal twice by @simonbasle in #3045 - Fix cancel too synchronized in
MonoCollect[List]by @simonbasle in #3053 - Async fusion bug: extra fixes and changes by @simonbasle in #3046
- ensures
onLastAssemblydoes not break fusion chain by @OlegDokuka in #3156 - Improve
Loggers.useConsoleLoggers()thread safety by @alexismanin in #3174 - Dispose picked worker when
BoundedElasticSchedulerrejects task by @Fearsin in #3183 - Allow blocking calls in
WorkerTask#disposeby @nathankooij in #3213 - fixes incorrect value/error set during
tryEmitXXXcall by @OlegDokuka in #3260 - cleans context for concat map for retry companion publisher by @OlegDokuka in #3262
- Fix meters documentation generation following renames by @simonbasle in #3217
- Fix subscription loss in
FluxTakeUntilOtherby @simonbasle in #3270 - Fix cancel behavior of
FluxTakeUntilOtherby @haraldpusch in #3219 - fixes breaking change for
fromFuturesource cancellation by @OlegDokuka in #3252
π Documentation, Tests and Build
- Fix
windowTimeoutstress test to use sinks by @OlegDokuka in #3074 - [test] Fix flaky
BoundedElasticTestwith better controlled tasks by @simonbasle in #2968 - [doc] Polish
Schedulersjavadoc for common/cached instances by @dedeibel in #2995 - Increase landscape width of refguide content for readability by @tmyksj in #3009
- [test] Improve flaky
BoundedElasticSchedulertoStringtest by @simonbasle in #3010 - Polish README by @simonbasle in #3007
- Refguide on mobile to use screen space optimally by @tmyksj in #3019
- Correct typo in metrics.adoc by @jarredhiggs in #3047
- Introducing JCStress tests for concurrent queues by @chemicL in #3069
- Fix doc typo: missing word in reactiveProgramming.adoc by @eduardNeagoe in #3075
- Make
context-propagation-apidependency optional + documentation by @simonbasle in #3100 - Clarify
ContextN.putAll(Map)intended internal use in javadoc by @chemicL in #3103 - Rework guide on Retry with Transient Errors by @simonbasle in #3093
- Adapt to the changes in the context propagation API by @violetagg in #3113
- Clarify how to use processExistingClasses in debugging.adoc by @kicmeri in #3130
- Refguide: Remove mention of discouraged subscribe variant by @simonbasle in #3141
- Removing outdated references to
Exceptions#bubble(Throwable)by @chemicL in #3160 - Document reactor-Core-Micrometer obs/meters/tags via enums by @simonbasle in #3175
- Improve JapiCmp: avoid misses, improve reporting and exclusions by @simonbasle in #3198
- Adapt to Micrometer SNAPSHOTs before RC1 by @simonbasle in #3215
- Micrometer Observation test: ensure assert fails the test by @simonbasle in #3220
- Polish Micrometer Docs generation by @simonbasle in #3225
- Document not to reuse/cache
EmitFailureHandle#busyLoopingby @He-Pin in #3224 - Rework the refguide section on metrics to focus on new module by @simonbasle in #3205
- Fix flaky
FluxPublishOnTestby @simonbasle in #3241 - Use new gha API for setting output, latest core actions by @simonbasle in #3237
- Minor polish on documentation by @glefloch in #3247
- various minor cleanups by @dfa1 in #3234
- Clean up references to fusion in
MonoSubscribercomments by @UgiR in #3261 - Document usage of the
EmitFailureHandler.busyLoopingin refguide by @ivyazmitinov in #3271 - Improve
MonofromFuture/fromCompletionStagejavadocs by @simonbasle in #3272 - Fix a couple
reactor-core-micrometermodule compilation errors by @simonbasle in #3132 - Disable flaky
BoundedElasticSchedulertest by @simonbasle in #3142
π Dependency Upgrades
- April round of upgrades superseding Renovate PRs by @simonbasle in #2992
- Update gradle/gradle-build-action to v2.1.5 by @simonbasle in #2996
- Update ByteBuddy to v1.12.9 by @simonbasle in #3008
- Switch Micrometer snapshots to 1.10.0-SNAPSHOT by @simonbasle in #3016
- Upgrade to Micrometer 1.10.0-M1 for 3.5.0-M2 by @simonbasle in #3025
- Upgrade Checkout action, Mockito, Spotless, Artifactory by @simonbasle in #3030
- Upgrade download, gradle enterprise, spotless, byteBuddy by @simonbasle in #3034
- June dependency upgrades by @simonbasle in #3066
- Update Reactive-Streams to v1.0.4 by @renovate-bot in #3055
- Update plugin bnd to v6.3.1 by @simonbasle in #3070
- July dependency upgrades by @simonbasle in #3115
- Update Micrometer dependency to version 1.10.0-M3 by @violetagg in #3116
- Upgrade Gradle to 7.5, workaround nohttp, update gradle action by @simonbasle in #3127
- Update Micrometer dependency to latest milestone releases by @violetagg in #3143
- Upgrade Gradle 7.5.1, Artifactory plugin 4.29.0 by @violetagg in #3144
- Update dependencies junit, mockito, spotless, download... by @simonbasle in #3169
- Update byte-buddy to v1.12.14 by @renovate-bot in #3134
- switches to all the Micrometer SNAPSHOTs by @simonbasle in #3179
- updates Micrometer dependency to latest milestone releases by @violetagg in #3190
- Update Micrometer dependency to 1.10.0-M6 by @chemicL in #3194
- Update dependencies junit, mockito, bytebuddy, jcstress, spotless... by @chemicL in #3218
- Update Micrometer dependency to RC1 by @violetagg in #3228
- Upgrade several plugins and test dependencies by @simonbasle in #3254
- Upgrade Micrometer/Context-Propagation dependencies to 1.10.0 GA by @simonbasle in #3274
New Contributors
- @dedeibel made their first contribution in #2995
- @tmyksj made their first contribution in #3009
- @ismailalammar made their first contribution in #2984
- @jarredhiggs made their first contribution in #3047
- @chemicL made their first contribution in #3069
- @eduardNeagoe made their first contribution in #3075
- @mdindoffer made their first contribution in #3097
- @kicmeri made their first contribution in #3130
- @lantalex made their first contribution in #3168
- @alexismanin made their first contribution in #3174
- @Fearsin made their first contribution in #3183
- @nathankooij made their first contribution in #3213
- @He-Pin made their first contribution in #3224
- @haraldpusch made their first contribution in #3219
- @glefloch made their first contribution in #3247
- @dfa1 made their first contribution in #3234
- @marcphilipp made their first contribution in #3263
Full Changelog: v3.4.16...v3.5.0