push
This commit is contained in:
@@ -2,9 +2,10 @@ package fr.istic.grpc.echo;
|
||||
|
||||
import com.google.rpc.context.AttributeContext.*;
|
||||
import fr.istic.grpc.echo.Echo.*;
|
||||
import fr.istic.grpc.echo.EchoServiceGrpc.*;
|
||||
|
||||
import io.grpc.*;
|
||||
|
||||
|
||||
public class EchoClient {
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
|
||||
@@ -1,17 +1,14 @@
|
||||
package fr.istic.grpc.echo;
|
||||
|
||||
import fr.istic.grpc.echo.Echo.MessageReceive;
|
||||
import fr.istic.grpc.echo.Echo.MessageSent;
|
||||
import fr.istic.grpc.todo.*;
|
||||
import io.grpc.*;
|
||||
import io.grpc.stub.StreamObserver;
|
||||
|
||||
import java.io.*;
|
||||
|
||||
public class EchoServeur {
|
||||
public void echo(MessageSent min, StreamObserver<MessageReceive> responseObserver) {
|
||||
MessageReceive reply = MessageReceive.newBuilder().setMessage(min.getMessage().toUpperCase()).build();
|
||||
responseObserver.onNext(reply);
|
||||
responseObserver.onCompleted();
|
||||
public static void main(String[] args) throws IOException, InterruptedException {
|
||||
Server server = ServerBuilder.forPort(8080).addService(new EchoService()).build().start();
|
||||
System.out.println("Serveur started");
|
||||
server.awaitTermination();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,5 +6,10 @@ import fr.istic.grpc.echo.EchoServiceGrpc.*;
|
||||
import io.grpc.stub.*;
|
||||
|
||||
public class EchoService extends EchoServiceImplBase {
|
||||
|
||||
public void echo(MessageSent min, StreamObserver<MessageReceive> responseObserver) {
|
||||
MessageReceive reply = MessageReceive.newBuilder().setMessage(min.getMessage().toUpperCase()).build();
|
||||
responseObserver.onNext(reply);
|
||||
responseObserver.onCompleted();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user