use of io.confluent.ksql.api.server.Server in project ksql by confluentinc.
the class BasePerfRunner method setUp.
private void setUp() {
vertx = Vertx.vertx();
KsqlRestConfig serverConfig = createServerConfig();
final ServerState serverState = new ServerState();
serverState.setReady();
server = new Server(vertx, serverConfig, endpoints, new KsqlDefaultSecurityExtension(), Optional.empty(), serverState, Optional.empty());
server.start();
client = createClient();
}
use of io.confluent.ksql.api.server.Server in project ksql by confluentinc.
the class AuthTest method createServer.
@Override
protected void createServer(KsqlRestConfig serverConfig) {
server = new Server(vertx, serverConfig, testEndpoints, new KsqlSecurityExtension() {
@Override
public void initialize(final KsqlConfig ksqlConfig) {
}
@Override
public Optional<KsqlAuthorizationProvider> getAuthorizationProvider() {
return Optional.ofNullable(authorizationProvider);
}
@Override
public Optional<KsqlUserContextProvider> getUserContextProvider() {
return Optional.ofNullable(userContextProvider);
}
@Override
public void close() {
}
}, Optional.ofNullable(securityHandlerPlugin), serverState, Optional.empty());
server.start();
}
use of io.confluent.ksql.api.server.Server 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