use of io.micronaut.configuration.graphql.GraphQLInvocationData in project micronaut-graphql by micronaut-projects.
the class GraphQLWsMessageHandler method executeRequest.
@SuppressWarnings("rawtypes")
private Publisher<GraphQLWsResponse> executeRequest(String operationId, GraphQLRequestBody payload, WebSocketSession session) {
GraphQLInvocationData invocationData = new GraphQLInvocationData(payload.getQuery(), payload.getOperationName(), payload.getVariables());
HttpRequest httpRequest = session.get(HTTP_REQUEST_KEY, HttpRequest.class).orElseThrow(() -> new RuntimeException("HttpRequest could not be retrieved from websocket session"));
Publisher<ExecutionResult> executionResult = graphQLInvocation.invoke(invocationData, httpRequest, null);
Publisher<GraphQLResponseBody> responseBody = graphQLExecutionResultHandler.handleExecutionResult(executionResult);
return Flux.from(responseBody).flatMap(body -> responseSender.send(operationId, body, session));
}
Aggregations