Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reactive DataFetcherExceptionResolver #52

Closed
rstoyanchev opened this issue May 18, 2021 · 0 comments
Closed

Reactive DataFetcherExceptionResolver #52

rstoyanchev opened this issue May 18, 2021 · 0 comments
Assignees
Labels
in: core Issues related to config and core support type: enhancement A general enhancement
Milestone

Comments

@rstoyanchev
Copy link
Contributor

rstoyanchev commented May 18, 2021

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.

@rstoyanchev rstoyanchev added type: enhancement A general enhancement in: core Issues related to config and core support labels May 18, 2021
@rstoyanchev rstoyanchev added this to the 0.1.0 milestone May 18, 2021
@rstoyanchev rstoyanchev self-assigned this May 18, 2021
@rstoyanchev rstoyanchev changed the title Reactive contract for DataFetcherExceptionResolver Reactive support for DataFetcherExceptionResolver May 18, 2021
@rstoyanchev rstoyanchev changed the title Reactive support for DataFetcherExceptionResolver Support for reactive DataFetcher exception handling May 18, 2021
@rstoyanchev rstoyanchev changed the title Support for reactive DataFetcher exception handling Reactive DataFetcherExceptionResolver May 18, 2021
rstoyanchev added a commit that referenced this issue May 19, 2021
This change separates the Reactor ContextView propagation into an
independent utility class to enable internal re-use.

See gh-52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: core Issues related to config and core support type: enhancement A general enhancement
Projects
None yet
Development

No branches or pull requests

1 participant