package org.tinsae.grpc;

import io.grpc.stub.StreamObserver;

public class HelloWorldServiceImpl extends
        HelloWorldServiceGrpc.HelloWorldServiceImplBase {
    @Override
    public void sayHello(HelloRequest req, StreamObserver<HelloReply> responseObserver) {

        System.out.println("Hello! Received: " + req.getName());

        System.out.println("Sending back: Hello " + req.getName());

        HelloReply reply = HelloReply.newBuilder().setMessage("Hello " + req.getName()).build();

        responseObserver.onNext(reply);

        responseObserver.onCompleted();
    }
}
