You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
DataFetcherExceptionResolver implementations need to be able to do non-blocking I/O and have access to the Reactor context, mirroring how a DataFetcher is now supported to return Flux or Mono.
For a concrete case, Spring Security needs to access security context when resolving an exception and on WebFlux this is most naturally obtained through the Reactor Context. Once obtained, the security context itself is deferred, in the form of Mono<SecurityContext> and hence the need for a non-blocking contract.
One option would be to change the contract to return Mono<List<GraphQLError>> rather than List<GraphQLError>. Another would be like a DataFetcher to support flexible return types, in this case checking for GraphQLError or a list, a Mono, or a Flux of them.
Ideally this would rely on a corresponding change in GraphQL Java to support an asynchronous DataFetcherExceptionHandler or otherwise we would need to switch threads ourselves to absorb the potential for blocking.
The text was updated successfully, but these errors were encountered:
DataFetcherExceptionResolver
implementations need to be able to do non-blocking I/O and have access to the Reactor context, mirroring how aDataFetcher
is now supported to returnFlux
orMono
.For a concrete case, Spring Security needs to access security context when resolving an exception and on WebFlux this is most naturally obtained through the Reactor Context. Once obtained, the security context itself is deferred, in the form of
Mono<SecurityContext>
and hence the need for a non-blocking contract.One option would be to change the contract to return
Mono<List<GraphQLError>>
rather thanList<GraphQLError>
. Another would be like aDataFetcher
to support flexible return types, in this case checking forGraphQLError
or a list, aMono
, or aFlux
of them.Ideally this would rely on a corresponding change in GraphQL Java to support an asynchronous
DataFetcherExceptionHandler
or otherwise we would need to switch threads ourselves to absorb the potential for blocking.The text was updated successfully, but these errors were encountered: