Uploaded image for project: 'Java Driver'
  1. Java Driver
  2. JAVA-3398

Consider Publisher<Void> instead of Publisher<Success>

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 4.0.0
    • Component/s: Reactive Streams
    • Labels:
      None
    • Backwards Compatibility:
      Major Change

      Description

      MongoDB driver returns Publisher<Success> for operations that do not return a value and which would be represented with void in an imperative API.

      Reactive API's are inherently event-oriented (onNext|onComplete|onError 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:

      • Project Reactor: Mono<Void>
      • RxJava 2: Completable type (manifestation via type system)
      • Akka Streams: CompletableFuture<Done> (using Java 8's type and Done to prevent null)

      It would be great if a future version of the Reactive Streams driver would adapt to Publisher<Void>.

      Reference:

        Attachments

          Activity

            People

            Assignee:
            ross.lawley Ross Lawley
            Reporter:
            mp911de Mark Paluch
            Participants:
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: