use of io.confluent.ksql.api.spi.Endpoints in project ksql by confluentinc.
the class KsqlRestApplication method startAsync.
@Override
public void startAsync() {
log.debug("Starting the ksqlDB API server");
this.serverMetadataResource = ServerMetadataResource.create(serviceContext, ksqlConfigNoPort);
final StatementParser statementParser = new StatementParser(ksqlEngine);
final Optional<KsqlAuthorizationValidator> authorizationValidator = KsqlAuthorizationValidatorFactory.create(ksqlConfigNoPort, serviceContext, securityExtension.getAuthorizationProvider());
final Errors errorHandler = new Errors(restConfig.getConfiguredInstance(KsqlRestConfig.KSQL_SERVER_ERROR_MESSAGES, ErrorMessages.class));
final KsqlRestConfig ksqlRestConfig = new KsqlRestConfig(ksqlConfigNoPort.originals());
oldApiWebsocketExecutor = MoreExecutors.listeningDecorator(Executors.newScheduledThreadPool(ksqlRestConfig.getInt(KsqlRestConfig.KSQL_WEBSOCKETS_NUM_THREADS), new ThreadFactoryBuilder().setDaemon(true).setNameFormat("websockets-query-thread-%d").build()));
this.wsQueryEndpoint = new WSQueryEndpoint(ksqlConfigNoPort, statementParser, ksqlEngine, commandStore, oldApiWebsocketExecutor, versionCheckerAgent::updateLastRequestTime, Duration.ofMillis(ksqlRestConfig.getLong(KsqlRestConfig.DISTRIBUTED_COMMAND_RESPONSE_TIMEOUT_MS_CONFIG)), authorizationValidator, errorHandler, denyListPropertyValidator, queryExecutor);
startAsyncThreadRef.set(Thread.currentThread());
try {
final Endpoints endpoints = new KsqlServerEndpoints(ksqlEngine, ksqlConfigNoPort, ksqlSecurityContextProvider, ksqlResource, streamedQueryResource, serverInfoResource, heartbeatResource, clusterStatusResource, statusResource, lagReportingResource, healthCheckResource, serverMetadataResource, wsQueryEndpoint, pullQueryMetrics, queryExecutor);
apiServer = new Server(vertx, ksqlRestConfig, endpoints, securityExtension, authenticationPlugin, serverState, pullQueryMetrics);
apiServer.start();
final KsqlConfig ksqlConfigWithPort = buildConfigWithPort();
configurables.forEach(c -> c.configure(ksqlConfigWithPort));
startKsql(ksqlConfigWithPort);
final Properties metricsProperties = new Properties();
metricsProperties.putAll(restConfig.getOriginals());
versionCheckerAgent.start(KsqlModuleType.SERVER, metricsProperties);
log.info("ksqlDB API server listening on {}", StringUtils.join(getListeners(), ", "));
displayWelcomeMessage();
} catch (AbortApplicationStartException e) {
log.error("Aborting application start", e);
} finally {
startAsyncThreadRef.set(null);
}
}
Aggregations