A joint research effort for building highly optimized Reactive-Streams compliant operators. Current implementors include RxJava2 and Reactor.
Java 8 required.
repositories {
maven { url 'https://repo.spring.io/libs-snapshot' }
}
dependencies {
compile 'io.projectreactor:reactive-streams-commons:0.6.0.BUILD-SNAPSHOT'
}
Snapshot directory.
I.e., converts non-reactive data sources into Publishers.
PublisherAmb: relays signals of that source Publisher which responds first with any signalPublisherArray: emits the elements of an arrayPublisherCallable: emits a single value returned by aCallablePublisherCompletableFuture: emits a single value produced by aCompletableFuturePublisherConcatArray: concatenate an array ofPublishersPublisherConcatIterable: concatenate anIterablesequence ofPublishersPublisherDefer: calls aSupplierto create the actualPublishertheSubscriberwill be subscribed to.PublisherEmpty: does not emit any value and callsonCompleted; useinstance()to get its singleton instance with the proper type parameterPublisherError: emits a constant or generated Throwable exceptionPublisherFuture: awaits and emits a single value emitted by aFuturePublisherGenerate: generate signals one-by-one via a functionPublisherInterval: periodically emits an ever increasing sequence of long valuesPublisherIterable: emits the elements of anIterablePublisherJust: emits a single valuePublisherNever: doesn't emit any signal other thanonSubscribe; useinstance()to get its singleton instance with the proper type parameterPublisherRange: emits a range of integer valuesPublisherStream: emits elements of aStreamPublisherTimer: emit a single 0L after a specified amount of timePublisherUsing: create a resource, stream values in a Publisher derived from the resource and release the resource when the sequence completes or the Subscriber cancelsPublisherZip: Repeatedly takes one item from all source Publishers and runs it through a function to produce the output item
ConnectablePublisherAutoConnectgiven a ConnectablePublisher, it connects to it once the given amount of subscribers subscribedConnectablePublisherRefCountgiven a ConnectablePublisher, it connects to it once the given amount of subscribers subscribed to it and disconnects once all subscribers cancelledConnectablePublisherPublish: allows dispatching events from a single source to multiple subscribers similar to a Processor but the connection can be manually established or stopped.PublisherAccumulate: Accumulates the source values with an accumulator function and returns the intermediate results of this function applicationPublisherAggregate: Aggregates the source values with an aggergator function and emits the last result.PublisherAll: emits a single true if all values of the source sequence match the predicatePublisherAny: emits a single true if any value of the source sequence matches the predicatePublisherAwaitOnSubscribe: makes sure onSubscribe can't trigger the onNext events until it returnsPublisherBuffer: buffers certain number of subsequent elements and emits the buffersPublisherBufferBoundary: buffers elements into continuous, non-overlapping lists where another Publisher signals the start/end of the buffer regionsPublisherBufferBoundaryAndSize: buffers elements into continuous, non-overlapping lists where the each buffer is emitted when they become full or another Publisher signals the boundary of the buffer regionsPublisherBufferStartEnd: buffers elements into possibly overlapping buffers whose boundaries are determined by a start Publisher's element and a signal of a derived PublisherPublisherCollect: collects the values into a container and emits it when the source completesPublisherCombineLatest: combines the latest values of many sources through a functionPublisherConcatMap: Maps each upstream value into a Publisher and concatenates them into one sequence of itemsPublisherCount: counts the number of elements the source sequence emitsPublisherDistinct: filters out elements that have been seen previously according to a custom collectionPublisherDistinctUntilChanged: filters out subsequent and repeated elementsPublisherDefaultIfEmpty: emits a single value if the source is emptyPublisherDelaySubscription: delays the subscription to the main source until the other source signals a value or completesPublisherDetach: detaches the both the child Subscriber and the Subscription on termination or cancellation.PublisherDrop: runs the source in unbounded mode and drops values if the downstream doesn't request fast enoughPublisherElementAt: emits the element at the specified index locationPublisherFilter: filters out values which doesn't pass a predicatePublisherFlatMap: maps a sequence of values each into a Publisher and flattens them back into a single sequence, interleaving events from the various inner PublishersPublisherFlattenIterable: concatenates values from Iterable sequences generated via a mapper functionPublisherGroupBy: groups source elements into their own Publisher sequences via a key functionPublisherIgnoreElements: ignores values and passes only the terminal signals alongPublisherIsEmpty: returns a single true if the source sequence is emptyPublisherLatest: runs the source in unbounded mode and emits the latest value if the downstream doesn't request fast enoughPublisherLift: maps the downstream Subscriber into an upstream Subscriber which allows implementing custom operators via lambdasPublisherMap: map values to other values via a functionPublisherPeek: peek into the lifecycle and signals of a streamPublisherReduce: aggregates the source values with the help of an accumulator function and emits the the final accumulated valuePublisherRepeat: repeatedly streams the source sequence fixed or unlimited timesPublisherRepeatPredicate: repeatedly stream the source if a predicate returns truePublisherRepeatWhen: repeats a source when a companion sequence signals an item in response to the main's completion signalPublisherResume: if the source fails, the stream is resumed by another Publisher returned by a function for the failure exceptionPublisherRetry: retry a failed source sequence fixed or unlimited timesPublisherRetryPredicate: retry if a predicate function returns true for the exceptionPublisherRetryWhen: retries a source when a companion sequence signals an item in response to the main's error signalPublisherSample: samples the main source whenever the other Publisher signals a valuePublisherScan: aggregates the source values with the help of an accumulator function and emits the intermediate resultsPublisherSingle: expects the source to emit only a single itemPublisherSkip: skips a specified amount of valuesPublisherSkipLast: skips the last N elementsPublisherSkipUntil: skips values until another sequence signals a value or completesPublisherSkipWhile: skips values while the predicate returns truePublisherStreamCollector: Collects the values from the source sequence into ajava.util.stream.Collectorinstance; seeCollectorsutility class in Java 8+PublisherSwitchIfEmpty: continues with another sequence if the first sequence turns out to be empty.PublisherSwitchMap: switches to and streams a Publisher generated via a function whenever the upstream signals a valuePublisherTake: takes a specified amount of values and completesPublisherTakeLast: emits only the last N values the source emitted before its completionPublisherTakeWhile: relays values while a predicate returns true for the values (checked before each value)PublisherTakeUntil: relays values until another Publisher signalsPublisherTakeUntilPredicate: relays values until a predicate returns true (checked after each value)PublisherThrottleFirst: takes a value from upstream then uses the duration provided by a generated Publisher to skip other values until that other Publisher signalsPublisherThrottleTimeout: emits the last value from upstream only if there were no newer values emitted during the time window provided by a publisher for that particular last valuePublisherTimeoutuses per-itemPublishers that when they fire mean the timeout for that particular item unless a new item arrives in the meantimePublisherWindow: splits the source sequence into possibly overlapping windows of given sizePublisherWindowBatch: batches the source sequence into continuous, non-overlapping windows where the length of the windows is determined by a fresh boundary Publisher or a maximum elemenets in that windowPublisherWindowBoundary: splits the source sequence into continuous, non-overlapping windows where the window boundary is signalled by another PublisherPublisherWindowBoundaryAndSize: splits the source sequence into continuous, non-overlapping windows where the window boundary is signalled by another Publisher or if a window received a specified amount of valuesPublisherWindowStartEnd: splits the source sequence into potentially overlapping windows controlled by a start Publisher and a derived end Publisher for each start valuePublisherWithLatestFrom: combines values from a master source with the latest values of another Publisher via a functionPublisherZip: Repeatedly takes one item from all source Publishers and runs it through a function to produce the output itemPublisherZipIterable: pairwise combines a sequence of values with elements from an iterable
I.e., these allow leaving the reactive-streams world.
BlockingIterable: an iterable that consumes a Publisher in a blocking fashionBlockingFuture: can return a future that consumes the source entierly and returns the very last valueBlockingStream: allows creating sequential and parallel j.u.stream.Stream flows out of a source PublisherPublisherBase.blockingFirst: returns the very first value of the source, blocking if necessary; returns null for an empty sequence.PublisherBase.blockingLast: returns the very last value of the source, blocking if necessary; returns null for an empty sequence.PublisherBase.peekLast: returns the last value of a synchronous source or likely null for other or empty sequences.