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

Consider Publisher<Void> instead of Publisher<Success>

    • Type: Icon: Improvement Improvement
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 4.0.0
    • Affects Version/s: None
    • Component/s: Reactive Streams
    • Labels:
      None
    • Major Change

      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:

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

              Created:
              Updated:
              Resolved: