Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use Vertx Grpc Server But do not use Vertx Grpc Client,Loop 10 call ,but blocked at first #41

Open
QinZhiWenXuan opened this issue Feb 20, 2023 · 2 comments
Labels
bug Something isn't working

Comments

@QinZhiWenXuan
Copy link

QinZhiWenXuan commented Feb 20, 2023

Questions

I am Grpc Server Use Vertx Grpc Serve build.Grpc Client do not use Vertx Grpc Client.Then I Loop 10 call ,but blocked at first。

Version

4.3.7

Context

  • Server
public class VertxStart extends AbstractVerticle {
    @Override
    public void start() {
        final var server = GrpcServer.server(vertx);
        final var greeter = new GreeterGrpc.GreeterImplBase() {
            @Override
            public void sayHello(final HelloRequest request, final StreamObserver<HelloReply> responseObserver) {
                System.out.println("Hello " + request.getName());
                final var reply = HelloReply.newBuilder().setMessage(request.getName()).build();
                responseObserver.onNext(reply);
                responseObserver.onCompleted();
            }

        };
        GrpcServiceBridge
                .bridge(greeter)
                .bind(server);
        vertx.createHttpServer().requestHandler(server).listen(4240);
    }
}
  • Client
    public static void main(String[] args) {
     
        new GreeterClient().start();
    }

   
    public void start() {
        final var channel = NettyChannelBuilder.forAddress("127.0.0.1", 4240).usePlaintext()
                .build();
        final var sub = GreeterGrpc.newBlockingStub(channel);
        for (int i = 0; i < 10; i++) {
            System.out.println("开始idx\t" + i);
            final var data = HelloRequest.newBuilder().setName("qwx" + i).build();
            final var resp = sub.sayHello(data);
            System.out.println("resp\t" + resp.getMessage());
            System.out.println("结束idx\t" + i);
        }
        channel.shutdown() ;
    }
}

Extra

  • JDK 11
@QinZhiWenXuan QinZhiWenXuan added the bug Something isn't working label Feb 20, 2023
@QinZhiWenXuan
Copy link
Author

Do I have to use Vertx Grpc Client?

@liangyuanpeng
Copy link

Do I have to use Vertx Grpc Client?

I don't think so, maybe just have not connect success? @QinZhiWenXuan

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants