Package graphql.execution.reactive
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")
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final CompletionStageMappingPublisher
<ExecutionResult, Object> -
Constructor Summary
ConstructorsConstructorDescriptionSubscriptionPublisher
(org.reactivestreams.Publisher<Object> upstreamPublisher, Function<Object, CompletionStage<ExecutionResult>> mapper) Subscription consuming code is not expected to create instances of this class -
Method Summary
Modifier and TypeMethodDescriptionorg.reactivestreams.Publisher
<Object> void
subscribe
(org.reactivestreams.Subscriber<? super ExecutionResult> subscriber)
-
Field Details
-
mappingPublisher
-
-
Constructor Details
-
SubscriptionPublisher
public SubscriptionPublisher(org.reactivestreams.Publisher<Object> upstreamPublisher, Function<Object, CompletionStage<ExecutionResult>> mapper) 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 themmapper
- a mapper that turns object into promises to execution results which are then published on this stream
-
-
Method Details
-
getUpstreamPublisher
- Returns:
- the underlying Publisher that was providing raw objects to the subscription field, whose published values are then mapped to execution results
-
subscribe
- Specified by:
subscribe
in interfaceorg.reactivestreams.Publisher<ExecutionResult>
-