Interface GraphQlTransport
public interface GraphQlTransport
Contract for executing GraphQL requests over some transport.
- Since:
- 1.0.0
- Author:
- Rossen Stoyanchev
-
Method Summary
Modifier and TypeMethodDescriptionstatic GraphQlResponsecreateResponse(Map<String, Object> responseMap) Factory method to createGraphQlResponsefrom a GraphQL response map for use in transport implementations.reactor.core.publisher.Mono<GraphQlResponse> execute(GraphQlRequest request) Execute a request with a single response such as a "query" or "mutation".reactor.core.publisher.Flux<GraphQlResponse> executeSubscription(GraphQlRequest request) Execute a "subscription" request with a stream of responses.
-
Method Details
-
execute
Execute a request with a single response such as a "query" or "mutation".- Parameters:
request- the request to execute- Returns:
- a
Monowith theGraphQlResponsefor the response. TheMonomay end wth an error due to transport or other issues such as failures to encode the request or decode the response.
-
executeSubscription
Execute a "subscription" request with a stream of responses.- Parameters:
request- the request to execute- Returns:
- a
FluxofGraphQlResponseresponses. TheFluxmay terminate as follows:- Completes if the subscription completes before the connection is closed.
SubscriptionErrorExceptionif the subscription ends with an error.WebSocketDisconnectedExceptionif the connection is closed or lost before the stream terminates.- Exception for connection and GraphQL session initialization issues.
The
Fluxmay be cancelled to notify the server to end the subscription stream.
-
createResponse
Factory method to createGraphQlResponsefrom a GraphQL response map for use in transport implementations.- Parameters:
responseMap- the GraphQL response map
-