Announcing First Release Candidate of Reactor Core 3.1
On behalf of the Reactor team, it is my pleasure to announce that reactor-core 3.1.0.RC1
has been released 🎉. This is a big last step towards GA release of 3.1 at the end of the month, the long term support version that will back Spring 5!
It is also complemented by various releases, all tied together in the Bismuth-M4
Release Train and BOM:
reactor-test
,reactor-extra
,reactor-adapter
andreactor-logback
all made the cut to3.1.0.RC1
reactor-netty
has seen significant updates and bug fixes in the new0.7.0.M2
milestonereactor-kafka
has been released in its1.0.0.M4
milestone
In order to get this release, the best way is to use the BOM, as described in the reference guide here. Make sure to read the part about milestones (transposing it to Bismuth-M4).
Important Changes in Reactor-Core
Since we did not make many announcements since MILESTONE 1, let’s have a slightly deeper look at the main changes in reactor-core
3.1.0, which has the most changes.
We reserved the option of making API changes until 3.1.0.RELEASE, and this allowed us to collect great feedback from our community and from the Spring Framework team. Thus we were able to polish the API and come up with something we feel is 100% suited for the long term ride along Spring Framework 5.0.
These changes have been progressively made since the first MILESTONE of Reactor 3.1.0, and you can head to the release notes on Github for a complete changelog, especially if you haven’t upgraded to any of these since the 3.0.7.RELEASE
.
Here is a non-exhaustive overview of these changes:
Better Alignment of Flux and Mono APIs
- Mono and Flux error handling operators have been adjusted. (M1)
Mono#flatMap
has becomeflatMapMany
and Mono.then (Mono<V> then(Function<T, Mono<V> other)
) is nowflatMap
. (M1)- Tuple-returning
Mono.when
static methods andMono#and
are nowzip
andzipWith
, consistent with theirFlux
counterparts. Note thewhen
andand
methods still exist in 3.1.0.RC1 but they are specific to the case where one is only interested in the completion of severalPublisher
objects (represented as aMono<Void>
return type). (RC1) - The
Flux#firstEmitting
static method is now calledfirst
and theFlux#firstEmittingWith
instance method is now calledor
. (RC1)
Better Operator Consistency
- A
*When
suffix is used for operator variants that take a companionPublisher
or that perform the same task as their unsuffixed counterparts asynchronously. (M1) - All
delayError
parameter variants have been removed in favor of adding an alias suffixed withDelayError
(for exampleflatMapDelayError
). (M1) - All
*Millis
variants (taking along
duration) have been removed in favor ofDuration
based variants. (M1)
These changes usually have the added benefit of removing any ambiguity about which override of
the method to apply when using lambdas, especially from languages like Kotlin.
Mono Specific APIs
Mono
has several APIs that deal with completion of tasks. They basically ignore the elements (if any) and propagate only the onComplete
signals.
Before RC1, these APIs would also have overrides that wouldn’t be focused on this task-completion use case, introducing some confusion. As of RC1 these variants have all been renamed (eg. the Mono<Tuple2> and(Mono<V> other)
has been renamed zipWith
).
The task-completion oriented variants, which have been kept, can be spotted by the fact that they return a Mono<Void>
. They now work with any Publisher
, not just Monos:
when
static methods fire several provided tasks at once and wait for all of them to completeand
does the same when called from aMono
, with a single providedPublisher
then
is about forgetting the element(s) of the source to only signal its completion
Other Changes
reactor-test
sources have been moved to the same repo asreactor-core
and the artifact is now under theio.projectreactor
groupId in Maven. (M2)Hooks
are cumulative (M3) and can be partially set/reset using a key (RC1)WorkQueueProcessor
andTopicProcessor
have many construction options, now represented as aBuilder
(M2)Processor
implementations in Reactor have been heavily reworked and a facadeSink
interface has been created to ease direct interactions with processors. UseProcessor#sink()
to obtain and keep a reference to this facade. (M3)- A
Flux
/Mono
can be tagged with multipletag
annotations or aname
annotation. (M3) - It is now possible to tie a
Context
to a reactive sequence upon subscribing to it, usingsubscriberContext(Context)
. This context is propagated upstream along with the subscription signal. (RC1)
The Road from Here
The next two weeks will be all about preparing the GA release, for which we do not expect any new change other than documentation and a few new operators.
But it is also the last opportunity for you to try the changes out and give feedback! So please give it a roll as soon as you can, and come back to us with any feedback you might have (on GitHub or via Gitter chat)
Happy reactive coding!