proxy server
This commit is contained in:
parent
10d4f8a966
commit
cf32ecc88e
|
@ -23,12 +23,14 @@ public class ServiceProxy {
|
||||||
private static final Logger logger = Logger.getLogger(ServiceProxy.class.getName());
|
private static final Logger logger = Logger.getLogger(ServiceProxy.class.getName());
|
||||||
|
|
||||||
private io.grpc.Server server;
|
private io.grpc.Server server;
|
||||||
|
public static ApplicationContext ctx;
|
||||||
|
|
||||||
public ServiceProxy() {
|
public ServiceProxy() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void start(int port) throws IOException {
|
public void start(int port) throws IOException {
|
||||||
|
ctx = new AnnotationConfigApplicationContext("com.loafle.overflow");
|
||||||
server = ServerBuilder.forPort(port)
|
server = ServerBuilder.forPort(port)
|
||||||
.addService(new ServiceImpl())
|
.addService(new ServiceImpl())
|
||||||
.build()
|
.build()
|
||||||
|
@ -61,7 +63,7 @@ public class ServiceProxy {
|
||||||
@Override
|
@Override
|
||||||
public void exec(ServerInput request,
|
public void exec(ServerInput request,
|
||||||
io.grpc.stub.StreamObserver<ServerOutput> responseObserver) {
|
io.grpc.stub.StreamObserver<ServerOutput> responseObserver) {
|
||||||
ApplicationContext ctx = new AnnotationConfigApplicationContext("com.loafle.overflow");
|
|
||||||
String targetServiceName = request.getTarget();
|
String targetServiceName = request.getTarget();
|
||||||
Object service = ctx.getBean(targetServiceName);
|
Object service = ctx.getBean(targetServiceName);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user