use of com.alibaba.graphscope.groot.rpc.RpcServer in project GraphScope by alibaba.
the class Frontend method buildServiceServer.
private RpcServer buildServiceServer(Configs configs, BindableService... services) {
int port = FrontendConfig.FRONTEND_SERVICE_PORT.get(configs);
int threadCount = FrontendConfig.FRONTEND_SERVICE_THREAD_COUNT.get(configs);
int maxBytes = CommonConfig.RPC_MAX_BYTES_MB.get(configs) * 1024 * 1024;
NettyServerBuilder builder = NettyServerBuilder.forPort(port);
builder.executor(RpcUtils.createGrpcExecutor(threadCount)).maxInboundMessageSize(maxBytes);
String username = FrontendConfig.AUTH_USERNAME.get(configs);
String password = FrontendConfig.AUTH_PASSWORD.get(configs);
if (!username.isEmpty()) {
AuthorizationServerInterceptor interceptor = new AuthorizationServerInterceptor(Collections.singletonMap(username, password));
builder.intercept(interceptor);
}
LocalNodeProvider lnp = new LocalNodeProvider(RoleType.FRONTEND_SERVICE, configs);
return new RpcServer(builder, lnp, services);
}
use of com.alibaba.graphscope.groot.rpc.RpcServer in project GraphScope by alibaba.
the class RpcServerTest method testRpcServer.
@Test
void testRpcServer() throws IOException {
int port = 1111;
Configs configs = Configs.newBuilder().put(CommonConfig.RPC_PORT.getKey(), String.valueOf(port)).put(CommonConfig.ROLE_NAME.getKey(), RoleType.STORE.getName()).put(CommonConfig.NODE_IDX.getKey(), "0").build();
LocalNodeProvider localNodeProvider = new LocalNodeProvider(configs);
RpcServer rpcServer = new RpcServer(configs, localNodeProvider);
rpcServer.start();
MaxGraphNode localNode = localNodeProvider.get();
assertEquals(port, localNode.getPort());
assertEquals(port, rpcServer.getPort());
rpcServer.stop();
}
Aggregations