<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 08:59:31 UTC 2024

It is possible to restrict the fields that are returned in this document by specifying the 'field' parameter in your request.
For example, to request only the issue key and summary append 'field=key&field=summary' to the URL of your request.
-->
<rss version="0.92" >
<channel>
    <title>MongoDB Jira</title>
    <link>https://jira.mongodb.org</link>
    <description>This file is an XML representation of an issue</description>
    <language>en-us</language>    <build-info>
        <version>9.7.1</version>
        <build-number>970001</build-number>
        <build-date>13-04-2023</build-date>
    </build-info>


<item>
            <title>[JAVA-3398] Consider Publisher&lt;Void&gt; instead of Publisher&lt;Success&gt;</title>
                <link>https://jira.mongodb.org/browse/JAVA-3398</link>
                <project id="10006" key="JAVA">Java Driver</project>
                    <description>&lt;p&gt;MongoDB driver returns &lt;tt&gt;Publisher&amp;lt;Success&amp;gt;&lt;/tt&gt; for operations that do not return a value and which would be represented with &lt;tt&gt;void&lt;/tt&gt; in an imperative API.&lt;/p&gt;

&lt;p&gt;Reactive API&apos;s are inherently event-oriented (&lt;tt&gt;onNext|onComplete|onError&lt;/tt&gt; signals) and do not require emission of a placeholder data element to signal successful completion. A successful termination without emitting an element would be the idiomatic approach for a Reactive Streams API. Each composition library has its own strategy how to represent the absence of elements/completion:&lt;/p&gt;


&lt;ul&gt;
	&lt;li&gt;Project Reactor: &lt;tt&gt;Mono&amp;lt;Void&amp;gt;&lt;/tt&gt;&lt;/li&gt;
	&lt;li&gt;RxJava 2: &lt;tt&gt;Completable&lt;/tt&gt; type (manifestation via type system)&lt;/li&gt;
	&lt;li&gt;Akka Streams: &lt;tt&gt;CompletableFuture&amp;lt;Done&amp;gt;&lt;/tt&gt; (using Java 8&apos;s type and &lt;tt&gt;Done&lt;/tt&gt; to prevent &lt;tt&gt;null&lt;/tt&gt;)&lt;/li&gt;
&lt;/ul&gt;


&lt;p&gt;It would be great if a future version of the Reactive Streams driver would adapt to &lt;tt&gt;Publisher&amp;lt;Void&amp;gt;&lt;/tt&gt;.&lt;/p&gt;

&lt;p&gt;Reference:&lt;/p&gt;
&lt;ul&gt;
	&lt;li&gt;&lt;a href=&quot;https://projectreactor.io/docs/core/release/reference/#mono&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;Project Reactor: Mono&lt;/a&gt;&lt;/li&gt;
	&lt;li&gt;&lt;a href=&quot;http://reactivex.io/RxJava/2.x/javadoc/io/reactivex/Flowable.html#ignoreElements()&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;RxJava 2: Flowable.ignoreElements()&lt;/a&gt;&lt;/li&gt;
	&lt;li&gt;&lt;a href=&quot;http://docs.spring.io/spring-framework/docs/5.0.0.RC2/javadoc-api/org/springframework/web/reactive/DispatcherHandler.html#handle-org.springframework.web.server.ServerWebExchange-&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;Spring WebFlux JavaDoc&lt;/a&gt;&lt;/li&gt;
	&lt;li&gt;&lt;a href=&quot;http://docs.spring.io/spring-data/mongodb/docs/2.0.0.M3/api/org/springframework/data/mongodb/core/ReactiveMongoOperations.html#dropCollection-java.lang.Class-&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;Spring Data Reactive MongoDB API JavaDoc&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
</description>
                <environment></environment>
        <key id="404644">JAVA-3398</key>
            <summary>Consider Publisher&lt;Void&gt; instead of Publisher&lt;Success&gt;</summary>
                <type id="4" iconUrl="https://jira.mongodb.org/secure/viewavatar?size=xsmall&amp;avatarId=14710&amp;avatarType=issuetype">Improvement</type>
                                            <priority id="3" iconUrl="https://jira.mongodb.org/images/icons/priorities/major.svg">Major - P3</priority>
                        <status id="6" iconUrl="https://jira.mongodb.org/images/icons/statuses/closed.png" description="The issue is considered finished, the resolution is correct. Issues which are closed can be reopened.">Closed</status>
                    <statusCategory id="3" key="done" colorName="success"/>
                                    <resolution id="13201">Fixed</resolution>
                                        <assignee username="ross@mongodb.com">Ross Lawley</assignee>
                                    <reporter username="mp911de">Mark Paluch</reporter>
                        <labels>
                    </labels>
                <created>Mon, 17 Jul 2017 14:08:39 +0000</created>
                <updated>Sat, 28 Oct 2023 11:22:05 +0000</updated>
                            <resolved>Fri, 8 Nov 2019 10:48:35 +0000</resolved>
                                                    <fixVersion>4.0.0</fixVersion>
                                    <component>Reactive Streams</component>
                                        <votes>0</votes>
                                    <watches>2</watches>
                                                                                                                <comments>
                            <comment id="2733156" author="xgen-internal-githook" created="Wed, 15 Jan 2020 22:32:58 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{&apos;name&apos;: &apos;Ross Lawley&apos;, &apos;username&apos;: &apos;rozza&apos;, &apos;email&apos;: &apos;ross.lawley@gmail.com&apos;}
&lt;p&gt;Message: Publisher&amp;lt;Success&amp;gt; =&amp;gt; Publisher&amp;lt;Void&amp;gt;&lt;/p&gt;

&lt;p&gt;Removed the Success enum to represent a successful operation. Idioms&lt;br/&gt;
have changed since the 1.0 version of the MongoDB Reactive Streams driver&lt;br/&gt;
and although null is an invalid value for a publisher. A Publisher&amp;lt;Void&amp;gt;&lt;br/&gt;
has come to represent empty publisher that only signals when a publisher has&lt;br/&gt;
either completed or errored.&lt;/p&gt;

&lt;p&gt;Removed the Scala type alias of Completed to Void. This brings the&lt;br/&gt;
implementation inline with the driver it wraps.&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://jira.mongodb.org/browse/JAVA-3398&quot; title=&quot;Consider Publisher&amp;lt;Void&amp;gt; instead of Publisher&amp;lt;Success&amp;gt;&quot; class=&quot;issue-link&quot; data-issue-key=&quot;JAVA-3398&quot;&gt;&lt;del&gt;JAVA-3398&lt;/del&gt;&lt;/a&gt;&lt;br/&gt;
Branch: master&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo-java-driver/commit/24780d53705de06d511af7e5cae18081449c9401&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo-java-driver/commit/24780d53705de06d511af7e5cae18081449c9401&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="2497168" author="ross@10gen.com" created="Wed, 23 Oct 2019 11:08:04 +0000"  >&lt;p&gt;PR: &lt;a href=&quot;https://github.com/rozza/mongo-java-driver/pull/333&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/rozza/mongo-java-driver/pull/333&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="2136581" author="jeff.yemin" created="Mon, 4 Feb 2019 15:26:17 +0000"  >&lt;p&gt;Consider for when we merge Reactive Streams into Java Driver 4.0.&lt;/p&gt;</comment>
                            <comment id="1623952" author="mp911de" created="Mon, 17 Jul 2017 18:52:58 +0000"  >&lt;p&gt;Hey &lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=ross.lawley&quot; class=&quot;user-hover&quot; rel=&quot;ross.lawley&quot;&gt;ross.lawley&lt;/a&gt;, &lt;/p&gt;

&lt;p&gt;The request wasn&apos;t intended for a minor version increment (1.x version) but rather a major release. Indeed, your driver was created in a time with high uncertainty about the ideal patterns. &lt;/p&gt;

&lt;p&gt;Emission of a &lt;tt&gt;null&lt;/tt&gt; value is not allowed by the Reactive Streams spec so no one would expect a null value to be emitted.&lt;br/&gt;
In fact, &lt;tt&gt;Publisher&amp;lt;Void&amp;gt;&lt;/tt&gt; expresses that no value is qualified for emission. Expectations are set to a publisher that just signals completion (successful/with an error). In terms of interoperability, &lt;tt&gt;Void&lt;/tt&gt; is a common base type and &lt;tt&gt;Publisher&amp;lt;Void&amp;gt;&lt;/tt&gt; are meanwhile well-known.&lt;/p&gt;

&lt;p&gt;RxJava 2 has a rich type-system that isn&apos;t entirely based on the Reactive Streams spec, only &lt;tt&gt;Flowable&lt;/tt&gt; is a &lt;tt&gt;Publisher&lt;/tt&gt;. &lt;/p&gt;</comment>
                            <comment id="1623902" author="ross@10gen.com" created="Mon, 17 Jul 2017 18:16:12 +0000"  >&lt;p&gt;Hi &lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=mp911de&quot; class=&quot;user-hover&quot; rel=&quot;mp911de&quot;&gt;mp911de&lt;/a&gt;,&lt;/p&gt;

&lt;p&gt;Thanks for the ticket. Unfortunately, this would be an API break and would require a major release.  Back when the reactive streams API was still in beta, there wasn&apos;t a clear consensus on what pattern should be used for a successful operation. If I recall correctly, &lt;tt&gt;Publisher&amp;lt;Void&amp;gt;&lt;/tt&gt; was explicitly frowned upon at the time; as results couldn&apos;t be &lt;tt&gt;null&lt;/tt&gt; it was deemed invalid. &lt;/p&gt;

&lt;p&gt;It seems more patterns have come from usage overtime and a wider consensus has evolved, and two new Publisher types have evolved: Completable and Single Publishers. Essentially, the &lt;tt&gt;Publisher&amp;lt;Success&amp;gt;&lt;/tt&gt; is comparable with the differing &lt;tt&gt;Completable&lt;/tt&gt; strategies and achieve the same aim.&lt;/p&gt;

&lt;p&gt;Ross&lt;/p&gt;</comment>
                    </comments>
                <issuelinks>
                            <issuelinktype id="10012">
                    <name>Related</name>
                                            <outwardlinks description="related to">
                                        <issuelink>
            <issuekey id="1875996">JAVA-4303</issuekey>
        </issuelink>
                            </outwardlinks>
                                                        </issuelinktype>
                    </issuelinks>
                <attachments>
                    </attachments>
                <subtasks>
                    </subtasks>
                <customfields>
                                                                                                                                                                                                                        <customfield id="customfield_10011" key="com.atlassian.jira.plugin.system.customfieldtypes:radiobuttons">
                        <customfieldname>Backwards Compatibility</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue key="10012"><![CDATA[Major Change]]></customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                <customfield id="customfield_15850" key="com.atlassian.jira.plugins.jira-development-integration-plugin:devsummary">
                        <customfieldname>Development</customfieldname>
                        <customfieldvalues>
                            
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    <customfield id="customfield_12550" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>2|hr7m3z:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10558" key="com.pyxis.greenhopper.jira:gh-global-rank">
                        <customfieldname>Rank (Obsolete)</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>9223372036854775807</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            </customfields>
    </item>
</channel>
</rss>