Interface GraphQLStream


public interface GraphQLStream

The events of a subscription field: what a @SubscriptionMapping method returns, in place of Spring for GraphQL's Flux.

Each event is resolved against the subscription's selection set as though it were the field's value, and sent to the client as one response.

@SubscriptionMapping
public GraphQLStream bookAdded() {
    return emitter -> {
        Subscription s = messaging.subscribe("books", m -> emitter.next(m.getBody()));
        return s::cancel;
    };
}
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Interface
    Description
    static interface 
    Where a stream sends what it produces.
  • Method Summary

    Modifier and Type
    Method
    Description
    Starts the stream.
  • Method Details

    • open

      Starts the stream. Events, an error or completion go to emitter, from any thread.

      Returns

      what stops the stream when the client unsubscribes or disconnects; may be null

      Throws:
      Exception