-
Notifications
You must be signed in to change notification settings - Fork 27
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
GrpcServiceBridgeImpl
should set exception handling callback
#101
Labels
bug
Something isn't working
Comments
If you use vert.x grpc server, the |
can someone provide a reproducer for this ? |
@vietj here you are. step 1: define a bidistream grpc api// filename: echo.proto
syntax = "proto3";
service EchoGrpc {
rpc Bidirectional(stream Str) returns (stream Str) {}
}
message Str {
string val = 1;
} step 2: generate grpc codesfollow this step 3: implement it and build a serverimport Echo.Str;
import EchoGrpcGrpc.EchoGrpcImplBase;
import io.grpc.stub.StreamObserver;
import io.vertx.core.Vertx;
import io.vertx.grpc.server.GrpcServer;
import io.vertx.grpc.server.GrpcServiceBridge;
public class Main {
public static void main(String... args) throws InterruptedException {
var vertx = Vertx.vertx();
var grpcServer = GrpcServer.server(vertx);
var bridge = GrpcServiceBridge.bridge(new EchoGrpcImpl());
bridge.bind(grpcServer);
var httpServer = vertx.createHttpServer();
httpServer.requestHandler(grpcServer);
httpServer.listen(8080);
Thread.currentThread().join();
}
static class EchoGrpcImpl extends EchoGrpcImplBase {
@Override
public StreamObserver<Str> bidirectional(StreamObserver<Str> responseObserver) {
return new StreamObserver<Str>() {
@Override public void onNext(Str value) {
System.out.println("on next " + value);
responseObserver.onNext(value);
}
@Override public void onError(Throwable t) {
System.out.println("on error");
t.printStackTrace(System.out);
responseObserver.onError(t);
}
@Override public void onCompleted() {
System.out.println("on completed");
responseObserver.onCompleted();
}
};
}
}
} step 4: disconnect when calling the apiinstall grpcurlbrew install grpcurl call, then press
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Questions
When I using
GrpcServiceBridgeImpl
, some of the behavior of vertx-grpc is not as expected when the network is abnormal.Expect Behavior
vertx-grpc/vertx-grpc-server/src/main/java/io/vertx/grpc/server/impl/GrpcServiceBridgeImpl.java
Lines 148 to 157 in fca746c
if the network between client and server was interrupted,
listener.onCancel()
should be invoked.Actual Behavior
nothing happened.
Version
4.5.7
The
errorHandler
is an method fromGrpcReadStream
, it was invoked only when the httpStream has aStreamResetException
, but when client was killed, anIOException
occurred.vertx-grpc/vertx-grpc-common/src/main/java/io/vertx/grpc/common/impl/GrpcReadStreamBase.java
Lines 71 to 81 in fca746c
The text was updated successfully, but these errors were encountered: