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
BatchMapping annotation has been recently introduced as a substitute to configuring BatchLoaderRegistry and using annotation SchemaMapping. In the docs it is not specified that solely using the BatchMapping annotation does not do a parallel execution for field resolvers, how do we enable parallel fetch for field resolvers when using batchmapping and Java 17.
The text was updated successfully, but these errors were encountered:
@SchemaMapping and @BatchMapping methods can return Callable that is submitted to an Executor such as the Spring Framework VirtualThreadTaskExecutor. To enable this, you must configure an Executor on AnnotatedControllerConfigurer.
Can we have an example of this , how to "configure an Executor on AnnotatedControllerConfigurer"?
As I'm creating the bean like following and the code is not executing on different threads, even after using both schemamapping and batchmapping annotation.
@Bean
public DefaultBatchLoaderRegistry batchLoaderRegistry() {
return new DefaultBatchLoaderRegistry();
}
@Bean // <1>
public AnnotatedControllerConfigurer annotatedControllerConfigurer() {
AnnotatedControllerConfigurer annotatedControllerConfigurer= new AnnotatedControllerConfigurer();
annotatedControllerConfigurer.setExecutor(new VirtualThreadTaskExecutor());
return annotatedControllerConfigurer;
}
@Bean // <2>
public ExecutionGraphQlService executionGraphQlService() {
GraphQlSource graphQlSource = GraphQlSource.schemaResourceBuilder() // <3>
.schemaResources(new ClassPathResource("graphql/schema.graphqls"))
.configureRuntimeWiring(annotatedControllerConfigurer())
.build();
DefaultExecutionGraphQlService service = new DefaultExecutionGraphQlService(graphQlSource);
service.addDataLoaderRegistrar(batchLoaderRegistry());
return service;
}
BatchMapping annotation has been recently introduced as a substitute to configuring BatchLoaderRegistry and using annotation SchemaMapping. In the docs it is not specified that solely using the BatchMapping annotation does not do a parallel execution for field resolvers, how do we enable parallel fetch for field resolvers when using batchmapping and Java 17.
The text was updated successfully, but these errors were encountered: