Class SubscriptionPublisher

java.lang.Object
graphql.execution.reactive.SubscriptionPublisher
All Implemented Interfaces:
org.reactivestreams.Publisher<ExecutionResult>

@PublicApi public class SubscriptionPublisher extends Object implements org.reactivestreams.Publisher<ExecutionResult>
Subscription queries return an instance of this class in the ExecutionResult data element for the subscribed field.

      ExecutionResult er = graphQL.execute("subscription s { onEntityChanged(id : "1") { selection1, selection2 }}")
      SubscriptionPublisher eventPublisher = er.getData("onEntityChanged")
 
 
  • Constructor Details

    • SubscriptionPublisher

      public SubscriptionPublisher(org.reactivestreams.Publisher<Object> upstreamPublisher, Function<Object,CompletionStage<ExecutionResult>> mapper, boolean keepOrdered)
      Subscription consuming code is not expected to create instances of this class
      Parameters:
      upstreamPublisher - the original publisher of objects that then have a graphql selection set applied to them
      mapper - a mapper that turns object into promises to execution results which are then published on this stream
      keepOrdered - this indicates that the order of results should be kep in the same order as the source events arrive
  • Method Details

    • getUpstreamPublisher

      public org.reactivestreams.Publisher<Object> getUpstreamPublisher()
      Returns:
      the underlying Publisher that was providing raw objects to the subscription field, whose published values are then mapped to execution results
    • subscribe

      public void subscribe(org.reactivestreams.Subscriber<? super ExecutionResult> subscriber)
      Specified by:
      subscribe in interface org.reactivestreams.Publisher<ExecutionResult>