Package org.forum.server.specific_code
Class DataFetchersDelegateSubscriptionImpl
java.lang.Object
org.forum.server.specific_code.DataFetchersDelegateSubscriptionImpl
- All Implemented Interfaces:
DataFetchersDelegateSubscription
@Component
public class DataFetchersDelegateSubscriptionImpl
extends Object
implements DataFetchersDelegateSubscription
- Author:
- etienne-sf
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionreactor.core.publisher.Flux<Post>
subscribeToNewPost
(graphql.schema.DataFetchingEnvironment dataFetchingEnvironment, String boardName) This method loads the data for Subscription.subscribeToNewPost.
-
Constructor Details
-
DataFetchersDelegateSubscriptionImpl
public DataFetchersDelegateSubscriptionImpl()
-
-
Method Details
-
subscribeToNewPost
public reactor.core.publisher.Flux<Post> subscribeToNewPost(graphql.schema.DataFetchingEnvironment dataFetchingEnvironment, String boardName) Description copied from interface:DataFetchersDelegateSubscription
This method loads the data for Subscription.subscribeToNewPost. It may return whatever is accepted by the Spring Controller, that is:- A resolved value of any type (typically, a org.forum.server.graphql.Post)
- Mono and Flux for asynchronous value(s). Supported for controller methods and for any DataFetcher as described in Reactive DataFetcher. This would typically be a Mono<org.forum.server.graphql.Post> or a Flux<org.forum.server.graphql.Post>
- Kotlin coroutine and Flow are adapted to Mono and Flux
- java.util.concurrent.Callable to have the value(s) produced asynchronously. For this to work, AnnotatedControllerConfigurer must be configured with an Executor. This would typically by a Callable<org.forum.server.graphql.Post>
- A CompletableFuture<?>, for instance CompletableFuture<org.forum.server.graphql.Post>. This allows to use graphql-java java-dataloader to highly optimize the number of requests to the server. The principle is this one: The data loader collects all the data to load, avoid to load several times the same data, and allows parallel execution of the queries, if multiple queries are to be run.
- A Publisher (instead of a Flux), for Subscription for instance
- Specified by:
subscribeToNewPost
in interfaceDataFetchersDelegateSubscription
- Parameters:
dataFetchingEnvironment
- The GraphQLDataFetchingEnvironment
. It gives you access to the full GraphQL context for this DataFetcherboardName
- The input parameter sent in the query by the GraphQL consumer, as defined in the GraphQL schema.
-