Skip to content

Commit

Permalink
[4368] Add GraphQL subscription exception handler
Browse files Browse the repository at this point in the history
Bug: #4368
Signed-off-by: Denis Nikiforov <[email protected]>
  • Loading branch information
AresEkb committed Jan 6, 2025
1 parent 885d0f8 commit a3b8b6d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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
}
Expand Down Expand Up @@ -112,4 +115,5 @@ public GraphQLSchema graphQLSchema(ResourcePatternResolver resourcePatternResolv
}
return null;
}
}

}

0 comments on commit a3b8b6d

Please sign in to comment.