Class GraphQlRSocketHandler
java.lang.Object
org.springframework.graphql.server.GraphQlRSocketHandler
Handler for GraphQL over RSocket requests.
This class can be extended or wrapped from an @Controller
in order
to re-declare handle(Map)
and handleSubscription(Map)
with
@MessageMapping
annotations including the GraphQL endpoint route.
@Controller private static class GraphQlRSocketController { private final GraphQlRSocketHandler handler; GraphQlRSocketController(GraphQlRSocketHandler handler) { this.handler = handler; } @MessageMapping("graphql") public Mono<Map<String, Object>> handle(Map<String, Object> payload) { return this.handler.handle(payload); } @MessageMapping("graphql") public Flux<Map<String, Object>> handleSubscription(Map<String, Object> payload) { return this.handler.handleSubscription(payload); } }
- Since:
- 1.0.0
- Author:
- Rossen Stoyanchev
-
Constructor Summary
ConstructorsConstructorDescriptionGraphQlRSocketHandler
(ExecutionGraphQlService graphQlService, List<RSocketGraphQlInterceptor> interceptors, Encoder<?> jsonEncoder) Create a new instance that handles requests through a chain of interceptors followed by the givenExecutionGraphQlService
. -
Method Summary
-
Constructor Details
-
GraphQlRSocketHandler
public GraphQlRSocketHandler(ExecutionGraphQlService graphQlService, List<RSocketGraphQlInterceptor> interceptors, Encoder<?> jsonEncoder) Create a new instance that handles requests through a chain of interceptors followed by the givenExecutionGraphQlService
.- Parameters:
graphQlService
- the service that will execute the requestinterceptors
- interceptors to form the processing chainjsonEncoder
- a JSON encoder for serializing aGraphQLError
list for a failed subscription
-
-
Method Details