-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Revert breaking change with v4 generated code.
- Loading branch information
Showing
12 changed files
with
360 additions
and
360 deletions.
There are no files selected for viewing
59 changes: 0 additions & 59 deletions
59
vertx-grpc-docs/src/main/java/examples/GreeterGrpcServer.java
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
111 changes: 0 additions & 111 deletions
111
vertx-grpc-docs/src/main/java/examples/StreamingGrpcServer.java
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
61 changes: 61 additions & 0 deletions
61
vertx-grpc-docs/src/main/java/examples/VertxGreeterGrpcServer.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
package examples; | ||
|
||
import io.vertx.core.Future; | ||
import io.vertx.core.Promise; | ||
import io.vertx.core.Handler; | ||
import io.vertx.core.http.HttpServerRequest; | ||
import io.vertx.core.streams.ReadStream; | ||
import io.vertx.core.streams.WriteStream; | ||
import io.vertx.grpc.common.GrpcStatus; | ||
import io.vertx.grpc.common.ServiceName; | ||
import io.vertx.grpc.common.ServiceMethod; | ||
import io.vertx.grpc.common.GrpcMessageDecoder; | ||
import io.vertx.grpc.common.GrpcMessageEncoder; | ||
import io.vertx.grpc.server.GrpcServerResponse; | ||
import io.vertx.grpc.server.GrpcServer; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
public class VertxGreeterGrpcServer { | ||
|
||
public static final ServiceMethod<examples.HelloRequest, examples.HelloReply> SayHello = ServiceMethod.server( | ||
ServiceName.create("helloworld", "Greeter"), | ||
"SayHello", | ||
GrpcMessageEncoder.encoder(), | ||
GrpcMessageDecoder.decoder(examples.HelloRequest.parser())); | ||
|
||
public interface GreeterApi { | ||
|
||
default Future<examples.HelloReply> sayHello(examples.HelloRequest request) { | ||
throw new UnsupportedOperationException("Not implemented"); | ||
} | ||
default void sayHello(examples.HelloRequest request, Promise<examples.HelloReply> response) { | ||
sayHello(request) | ||
.onSuccess(msg -> response.complete(msg)) | ||
.onFailure(error -> response.fail(error)); | ||
} | ||
|
||
default GreeterApi bind_sayHello(GrpcServer server) { | ||
server.callHandler(SayHello, request -> { | ||
Promise<examples.HelloReply> promise = Promise.promise(); | ||
request.handler(req -> { | ||
try { | ||
sayHello(req, promise); | ||
} catch (RuntimeException err) { | ||
promise.tryFail(err); | ||
} | ||
}); | ||
promise.future() | ||
.onFailure(err -> request.response().status(GrpcStatus.INTERNAL).end()) | ||
.onSuccess(resp -> request.response().end(resp)); | ||
}); | ||
return this; | ||
} | ||
|
||
default GreeterApi bindAll(GrpcServer server) { | ||
bind_sayHello(server); | ||
return this; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.