From a3b8b6d0f622f92a34ac4775b9e1839daafd36fb Mon Sep 17 00:00:00 2001 From: Denis Nikiforov Date: Wed, 18 Dec 2024 14:53:50 +0300 Subject: [PATCH] [4368] Add GraphQL subscription exception handler Bug: https://github.com/eclipse-sirius/sirius-web/issues/4368 Signed-off-by: Denis Nikiforov --- CHANGELOG.adoc | 1 + .../configuration/graphql/GraphQLConfiguration.java | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.adoc b/CHANGELOG.adoc index a603fc5280..275c814b93 100644 --- a/CHANGELOG.adoc +++ b/CHANGELOG.adoc @@ -36,6 +36,7 @@ This may have some consequences for downstream applications which are embedding === Improvements +- https://github.com/eclipse-sirius/sirius-web/issues/4368[#4368] [sirius-web] Add GraphQL subscription exception handler == v2025.1.0 diff --git a/packages/sirius-web/backend/sirius-web-infrastructure/src/main/java/org/eclipse/sirius/web/infrastructure/configuration/graphql/GraphQLConfiguration.java b/packages/sirius-web/backend/sirius-web-infrastructure/src/main/java/org/eclipse/sirius/web/infrastructure/configuration/graphql/GraphQLConfiguration.java index 719c08a4cf..0e110eab06 100644 --- a/packages/sirius-web/backend/sirius-web-infrastructure/src/main/java/org/eclipse/sirius/web/infrastructure/configuration/graphql/GraphQLConfiguration.java +++ b/packages/sirius-web/backend/sirius-web-infrastructure/src/main/java/org/eclipse/sirius/web/infrastructure/configuration/graphql/GraphQLConfiguration.java @@ -30,6 +30,7 @@ import graphql.execution.AsyncSerialExecutionStrategy; import graphql.execution.DataFetcherExceptionHandler; import graphql.execution.ExecutionStrategy; +import graphql.execution.SubscriptionExecutionStrategy; import graphql.schema.GraphQLCodeRegistry; import graphql.schema.GraphQLSchema; import graphql.schema.idl.RuntimeWiring; @@ -65,10 +66,12 @@ public GraphQL graphQL(GraphQLSchema graphQLSchema) { // @see https://www.graphql-java.com/documentation/v11/execution/ The graphql specification says that mutations // MUST be executed serially and in the order in which the query fields occur. ExecutionStrategy mutationExecutionStrategy = new AsyncSerialExecutionStrategy(exceptionHandler); + ExecutionStrategy subscriptionExecutionStrategy = new SubscriptionExecutionStrategy(exceptionHandler); // @formatter:off return GraphQL.newGraphQL(graphQLSchema) .queryExecutionStrategy(queryExecutionStrategy) .mutationExecutionStrategy(mutationExecutionStrategy) + .subscriptionExecutionStrategy(subscriptionExecutionStrategy) .build(); // @formatter:on } @@ -112,4 +115,5 @@ public GraphQLSchema graphQLSchema(ResourcePatternResolver resourcePatternResolv } return null; } -} \ No newline at end of file + +}