use of spark.Service in project grakn by graknlabs.
the class GraknEngineServerTest method createGraknEngineServer.
private GraknEngineServer createGraknEngineServer(RedisWrapper redisWrapper) {
// grakn engine configuration
EngineID engineId = EngineID.me();
GraknEngineStatus status = new GraknEngineStatus();
MetricRegistry metricRegistry = new MetricRegistry();
// distributed locks
LockProvider lockProvider = new JedisLockProvider(redisWrapper.getJedisPool());
graknKeyspaceStore = GraknKeyspaceStoreFake.of();
// tx-factory
EngineGraknTxFactory engineGraknTxFactory = EngineGraknTxFactory.create(lockProvider, config, graknKeyspaceStore);
// post-processing
IndexStorage indexStorage = RedisIndexStorage.create(redisWrapper.getJedisPool(), metricRegistry);
CountStorage countStorage = RedisCountStorage.create(redisWrapper.getJedisPool(), metricRegistry);
IndexPostProcessor indexPostProcessor = IndexPostProcessor.create(lockProvider, indexStorage);
CountPostProcessor countPostProcessor = CountPostProcessor.create(config, engineGraknTxFactory, lockProvider, metricRegistry, countStorage);
PostProcessor postProcessor = PostProcessor.create(indexPostProcessor, countPostProcessor);
// http services: spark, http controller, and gRPC server
Service sparkHttp = Service.ignite();
Collection<HttpController> httpControllers = Collections.emptyList();
int grpcPort = config.getProperty(GraknConfigKey.GRPC_PORT);
GrpcOpenRequestExecutor requestExecutor = new GrpcOpenRequestExecutorImpl(engineGraknTxFactory);
Server server = ServerBuilder.forPort(grpcPort).addService(new GrpcGraknService(requestExecutor, postProcessor)).build();
GrpcServer grpcServer = GrpcServer.create(server);
QueueSanityCheck queueSanityCheck = new RedisSanityCheck(redisWrapper);
return GraknEngineServerFactory.createGraknEngineServer(engineId, config, status, sparkHttp, httpControllers, grpcServer, engineGraknTxFactory, metricRegistry, queueSanityCheck, lockProvider, postProcessor, graknKeyspaceStore);
}
Aggregations