Search in sources :

Example 6 with MutableFunctionRegistry

use of io.confluent.ksql.function.MutableFunctionRegistry 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

InternalFunctionRegistry (io.confluent.ksql.function.InternalFunctionRegistry)6 MutableFunctionRegistry (io.confluent.ksql.function.MutableFunctionRegistry)6 KsqlEngine (io.confluent.ksql.engine.KsqlEngine)5 SequentialQueryIdGenerator (io.confluent.ksql.query.id.SequentialQueryIdGenerator)4 ServiceContext (io.confluent.ksql.services.ServiceContext)3 KsqlConfig (io.confluent.ksql.util.KsqlConfig)3 ServiceInfo (io.confluent.ksql.ServiceInfo)2 UserFunctionLoader (io.confluent.ksql.function.UserFunctionLoader)2 ProcessingLogConfig (io.confluent.ksql.logging.processing.ProcessingLogConfig)2 ProcessingLogContext (io.confluent.ksql.logging.processing.ProcessingLogContext)2 DenyListPropertyValidator (io.confluent.ksql.properties.DenyListPropertyValidator)2 Errors (io.confluent.ksql.rest.Errors)2 Command (io.confluent.ksql.rest.server.computation.Command)2 CommandRunner (io.confluent.ksql.rest.server.computation.CommandRunner)2 CommandStore (io.confluent.ksql.rest.server.computation.CommandStore)2 ConnectServerErrors (io.confluent.ksql.rest.server.execution.ConnectServerErrors)2 KsqlAuthorizationValidator (io.confluent.ksql.security.KsqlAuthorizationValidator)2 KsqlVersionCheckerAgent (io.confluent.ksql.version.metrics.KsqlVersionCheckerAgent)2 VersionCheckerAgent (io.confluent.ksql.version.metrics.VersionCheckerAgent)2 File (java.io.File)2