8000 Request for Help on `GraphQL Stream (based on gRPC streaming)` · Issue #111 · google/rejoiner · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
This repository was archived by the owner on Aug 16, 2024. It is now read-only.
This repository was archived by the owner on Aug 16, 2024. It is now read-only.
Request for Help on GraphQL Stream (based on gRPC streaming) #111
Open
@william-maio-techlabs

Description

@william-maio-techlabs

Hello, I am having issue implementing GraphQL Stream (based on gRPC streaming) with the following exception:

class graphql.GraphQLContext cannot be cast to class com.google.api.graphql.grpc.RejoinerStreamingContext (graphql.GraphQLContext and com.google.api.graphql.grpc.RejoinerStreamingContext are in unnamed module of loader 'app')
java.lang.ClassCastException: class graphql.GraphQLContext cannot be cast to class com.google.api.graphql.grpc.RejoinerStreamingContext (graphql.GraphQLContext and com.google.api.graphql.grpc.RejoinerStreamingContext are in unnamed module of loader 'app')

I am referencing: https://github.com/google/rejoiner/tree/master/examples-gradle/src/main/java/com/google/api/graphql/examples/streaming

I am working with the following type of proto:
rpc SayHelloStreaming (HelloRequest) returns (stream Msg) {}
as oppose to
rpc SayHelloStreaming (HelloRequest) returns (stream HelloReply) {}
referenced here: https://github.com/google/rejoiner/blob/master/examples-gradle/src/main/proto/helloworld_streaming.proto#L27

I was able to create a non-stream version:

  @Query("SayHelloNoStream")
  HelloReply sayHelloNoStream(
      HelloRequest request,
      StreamingGreeterGrpc.StreamingGreeterBlockingStub blockingStub) {
    var iterator = blockingStub.sayHello(request);
    var builder = HelloReply.newBuilder();
    while (iterator.hasNext()){
      Msg msg = iterator.next();
      builder.addMsg(msg);
    }
    return builder.build();
  }

But with the stream version, I am getting class graphql.GraphQLContext cannot be cast to class exception

  @Query("SayHelloWithStream")
  HelloReply sayHelloWithStream(
      HelloRequest request,
      StreamingGreeterGrpc.StreamingGreeterStub streamStub,
      DataFetchingEnvironment dataFetchingEnvironment) {
    StreamObserver<Msg> observer =
        new GraphQlStreamObserver<Msg, Msg>(dataFetchingEnvironment) {
          @Override
          protected Msg getData(Msg value, ListValue path) {
            return value;
          }
        };
    streamStub.sayHello(request, observer);
    return null;
  }

I am using rejoiner 0.3.1

Thank you!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0