diff --git a/README.md b/README.md index 1bf97923..8ccc84a2 100644 --- a/README.md +++ b/README.md @@ -222,6 +222,20 @@ public interface Processor extends Subscriber, Publisher { While not mandated, it can be a good idea to cancel a `Processor`´s upstream `Subscription` when/if its last `Subscriber` cancels their `Subscription`, to let the cancellation signal propagate upstream. +#### 5.MonoPublisher ([Code](https://github.com/reactive-streams/reactive-streams-jvm/blob/master/api/src/main/java/org/reactivestreams/MonoPublisher.java)) + +```java +public interface MonoPublisher extends Publisher { +} +```` + +| ID | Rule | +| ------------------------ | ------------------------------------------------------------------------------------------------------ | +| 1 | A `MonoPublisher` represents a `Publisher` specialization and MUST obey its contract. | +| [:bulb:](#5.1 "5.1 explained") | *The intent of this rule is to establish that `MonoPublisher` can be used in place of any other `Publisher`.* | +| 2 | The total number of `onNext`´s signalled by a `MonoPublisher` to a `Subscriber` MUST be less than or equal to one, regardless of the total number requested by that `Subscriber`´s `Subscription` at all times. | +| [:bulb:](#5.2 "5.2 explained") | *The intent of this rule is to make it clear that MonoPublishers cannot signal more than one element per `Subscriber`´s `Subscription`.* | + ### Asynchronous vs Synchronous Processing ### The Reactive Streams API prescribes that all processing of elements (`onNext`) or termination signals (`onError`, `onComplete`) MUST NOT *block* the `Publisher`. However, each of the `on*` handlers can process the events synchronously or asynchronously. diff --git a/api/src/main/java/org/reactivestreams/MonoPublisher.java b/api/src/main/java/org/reactivestreams/MonoPublisher.java new file mode 100644 index 00000000..4e4f08b7 --- /dev/null +++ b/api/src/main/java/org/reactivestreams/MonoPublisher.java @@ -0,0 +1,21 @@ +/************************************************************************ + * Licensed under Public Domain (CC0) * + * * + * To the extent possible under law, the person who associated CC0 with * + * this code has waived all copyright and related or neighboring * + * rights to this code. * + * * + * You should have received a copy of the CC0 legalcode along with this * + * work. If not, see .* + ************************************************************************/ + +package org.reactivestreams; + +/** + * A {@link MonoPublisher} is a specialization of {@link Publisher} that emits at most one element. + * + * @param the type of element signaled + */ +public interface MonoPublisher extends Publisher { + +}