engagingspaces / vertx-graphql-service-discovery

Service discovery and querying of GraphQL schema's in Vert.x based microservices
Apache License 2.0
50 stars 8 forks source link

Wrap Query with execueBlocking #7

Open a-marcel opened 7 years ago

a-marcel commented 7 years ago

Hello,

so you see this: https://github.com/vert-x3/vertx-examples/blob/master/core-examples/src/main/java/io/vertx/example/core/execblocking/ExecBlockingExample.java

i just ask, if it's possible to wrap SchemaDefinition.class

@Override
    public void queryWithVariables(String graphqlQuery, JsonObject variables,
                                    Handler<AsyncResult<QueryResult>> resultHandler) {
        try {
            QueryResult result = queryBlocking(graphqlQuery, variables);
            resultHandler.handle(Future.succeededFuture(result));
        } catch (RuntimeException ex) {
            resultHandler.handle(Future.failedFuture(ex));
        }
    }

I know it's not perfect, but otherwise, a syncron datafetcher will block the thread. and it should be an easy task until graphql-java has the async implementation ?

Or are they other concerns and it will not work ?

Thanks Marcel

aschrijver commented 7 years ago

Thanks Marcel, for your PR, which I merged into a separate branch as explained in the PR comment.

a-marcel commented 7 years ago

Please use #10 now. It contains the new java graphl version

aschrijver commented 7 years ago

@marcelalburg thanks for PR'ing :+1: