Search in sources :

Example 1 with ConfigStore

use of io.confluent.ksql.rest.server.computation.ConfigStore in project ksql by confluentinc.

the class StandaloneExecutorFactory method create.

@VisibleForTesting
static StandaloneExecutor create(final Map<String, Object> properties, final String queriesFile, final String installDir, final Function<KsqlConfig, ServiceContext> serviceContextFactory, final BiFunction<String, KsqlConfig, ConfigStore> configStoreFactory, final Function<Supplier<Boolean>, VersionCheckerAgent> versionCheckerFactory, final StandaloneExecutorConstructor constructor, final MetricCollectors metricCollectors) {
    final KsqlConfig baseConfig = new KsqlConfig(properties);
    final ServiceContext serviceContext = serviceContextFactory.apply(baseConfig);
    final String configTopicName = ReservedInternalTopics.configsTopic(baseConfig);
    KsqlInternalTopicUtils.ensureTopic(configTopicName, baseConfig, serviceContext.getTopicClient());
    final ConfigStore configStore = configStoreFactory.apply(configTopicName, baseConfig);
    final KsqlConfig ksqlConfig = configStore.getKsqlConfig();
    final ProcessingLogConfig processingLogConfig = new ProcessingLogConfig(properties);
    final ProcessingLogContext processingLogContext = ProcessingLogContext.create(processingLogConfig);
    final MutableFunctionRegistry functionRegistry = new InternalFunctionRegistry();
    final KsqlEngine ksqlEngine = new KsqlEngine(serviceContext, processingLogContext, functionRegistry, ServiceInfo.create(ksqlConfig), new SequentialQueryIdGenerator(), ksqlConfig, Collections.emptyList(), metricCollectors);
    final UserFunctionLoader udfLoader = UserFunctionLoader.newInstance(ksqlConfig, functionRegistry, installDir, metricCollectors.getMetrics());
    final VersionCheckerAgent versionChecker = versionCheckerFactory.apply(ksqlEngine::hasActiveQueries);
    return constructor.create(serviceContext, processingLogConfig, ksqlConfig, ksqlEngine, queriesFile, udfLoader, true, versionChecker, Injectors.NO_TOPIC_DELETE, metricCollectors);
}
Also used : KsqlEngine(io.confluent.ksql.engine.KsqlEngine) ProcessingLogContext(io.confluent.ksql.logging.processing.ProcessingLogContext) MutableFunctionRegistry(io.confluent.ksql.function.MutableFunctionRegistry) ServiceContext(io.confluent.ksql.services.ServiceContext) UserFunctionLoader(io.confluent.ksql.function.UserFunctionLoader) ProcessingLogConfig(io.confluent.ksql.logging.processing.ProcessingLogConfig) KsqlConfig(io.confluent.ksql.util.KsqlConfig) KsqlVersionCheckerAgent(io.confluent.ksql.version.metrics.KsqlVersionCheckerAgent) VersionCheckerAgent(io.confluent.ksql.version.metrics.VersionCheckerAgent) KafkaConfigStore(io.confluent.ksql.rest.server.computation.KafkaConfigStore) ConfigStore(io.confluent.ksql.rest.server.computation.ConfigStore) SequentialQueryIdGenerator(io.confluent.ksql.query.id.SequentialQueryIdGenerator) InternalFunctionRegistry(io.confluent.ksql.function.InternalFunctionRegistry) VisibleForTesting(com.google.common.annotations.VisibleForTesting)

Aggregations

VisibleForTesting (com.google.common.annotations.VisibleForTesting)1 KsqlEngine (io.confluent.ksql.engine.KsqlEngine)1 InternalFunctionRegistry (io.confluent.ksql.function.InternalFunctionRegistry)1 MutableFunctionRegistry (io.confluent.ksql.function.MutableFunctionRegistry)1 UserFunctionLoader (io.confluent.ksql.function.UserFunctionLoader)1 ProcessingLogConfig (io.confluent.ksql.logging.processing.ProcessingLogConfig)1 ProcessingLogContext (io.confluent.ksql.logging.processing.ProcessingLogContext)1 SequentialQueryIdGenerator (io.confluent.ksql.query.id.SequentialQueryIdGenerator)1 ConfigStore (io.confluent.ksql.rest.server.computation.ConfigStore)1 KafkaConfigStore (io.confluent.ksql.rest.server.computation.KafkaConfigStore)1 ServiceContext (io.confluent.ksql.services.ServiceContext)1 KsqlConfig (io.confluent.ksql.util.KsqlConfig)1 KsqlVersionCheckerAgent (io.confluent.ksql.version.metrics.KsqlVersionCheckerAgent)1 VersionCheckerAgent (io.confluent.ksql.version.metrics.VersionCheckerAgent)1