Search in sources :

Example 1 with DisabledKsqlClient

use of io.confluent.ksql.services.DisabledKsqlClient in project ksql by confluentinc.

the class KsqlContext method create.

/**
 * Create a KSQL context object with the given properties. A KSQL context has it's own metastore
 * valid during the life of the object.
 */
public static KsqlContext create(final KsqlConfig ksqlConfig, final ProcessingLogContext processingLogContext, final MetricCollectors metricCollectors) {
    Objects.requireNonNull(ksqlConfig, "ksqlConfig cannot be null.");
    final ServiceContext serviceContext = ServiceContextFactory.create(ksqlConfig, DisabledKsqlClient::instance);
    final MutableFunctionRegistry functionRegistry = new InternalFunctionRegistry();
    UserFunctionLoader.newInstance(ksqlConfig, functionRegistry, ".", metricCollectors.getMetrics()).load();
    final ServiceInfo serviceInfo = ServiceInfo.create(ksqlConfig);
    final KsqlEngine engine = new KsqlEngine(serviceContext, processingLogContext, functionRegistry, serviceInfo, new SequentialQueryIdGenerator(), ksqlConfig, Collections.emptyList(), metricCollectors);
    return new KsqlContext(serviceContext, ksqlConfig, engine, Injectors.DEFAULT);
}
Also used : ServiceInfo(io.confluent.ksql.ServiceInfo) KsqlEngine(io.confluent.ksql.engine.KsqlEngine) MutableFunctionRegistry(io.confluent.ksql.function.MutableFunctionRegistry) DisabledKsqlClient(io.confluent.ksql.services.DisabledKsqlClient) ServiceContext(io.confluent.ksql.services.ServiceContext) SequentialQueryIdGenerator(io.confluent.ksql.query.id.SequentialQueryIdGenerator) InternalFunctionRegistry(io.confluent.ksql.function.InternalFunctionRegistry)

Example 2 with DisabledKsqlClient

use of io.confluent.ksql.services.DisabledKsqlClient in project ksql by confluentinc.

the class StandaloneExecutorFactory method create.

public static StandaloneExecutor create(final Map<String, String> properties, final String queriesFile, final String installDir, final MetricCollectors metricCollectors) {
    final KsqlConfig tempConfig = new KsqlConfig(properties);
    final Function<KsqlConfig, ServiceContext> serviceContextFactory = config -> ServiceContextFactory.create(config, DisabledKsqlClient::instance);
    final ServiceContext tempServiceContext = serviceContextFactory.apply(tempConfig);
    final String kafkaClusterId = KafkaClusterUtil.getKafkaClusterId(tempServiceContext);
    final String ksqlServerId = tempConfig.getString(KsqlConfig.KSQL_SERVICE_ID_CONFIG);
    final Map<String, Object> updatedProperties = tempConfig.originals();
    updatedProperties.putAll(metricCollectors.addConfluentMetricsContextConfigs(ksqlServerId, kafkaClusterId));
    return create(updatedProperties, queriesFile, installDir, serviceContextFactory, KafkaConfigStore::new, KsqlVersionCheckerAgent::new, StandaloneExecutor::new, metricCollectors);
}
Also used : InternalFunctionRegistry(io.confluent.ksql.function.InternalFunctionRegistry) SequentialQueryIdGenerator(io.confluent.ksql.query.id.SequentialQueryIdGenerator) BiFunction(java.util.function.BiFunction) ServiceContext(io.confluent.ksql.services.ServiceContext) ProcessingLogContext(io.confluent.ksql.logging.processing.ProcessingLogContext) MetricCollectors(io.confluent.ksql.metrics.MetricCollectors) ReservedInternalTopics(io.confluent.ksql.util.ReservedInternalTopics) Function(java.util.function.Function) Supplier(java.util.function.Supplier) KafkaConfigStore(io.confluent.ksql.rest.server.computation.KafkaConfigStore) Injector(io.confluent.ksql.statement.Injector) Map(java.util.Map) UserFunctionLoader(io.confluent.ksql.function.UserFunctionLoader) KafkaClusterUtil(io.confluent.ksql.services.KafkaClusterUtil) KsqlVersionCheckerAgent(io.confluent.ksql.version.metrics.KsqlVersionCheckerAgent) KsqlEngine(io.confluent.ksql.engine.KsqlEngine) MutableFunctionRegistry(io.confluent.ksql.function.MutableFunctionRegistry) KsqlInternalTopicUtils(io.confluent.ksql.rest.util.KsqlInternalTopicUtils) ServiceInfo(io.confluent.ksql.ServiceInfo) KsqlConfig(io.confluent.ksql.util.KsqlConfig) ServiceContextFactory(io.confluent.ksql.services.ServiceContextFactory) DisabledKsqlClient(io.confluent.ksql.services.DisabledKsqlClient) VersionCheckerAgent(io.confluent.ksql.version.metrics.VersionCheckerAgent) KsqlExecutionContext(io.confluent.ksql.KsqlExecutionContext) VisibleForTesting(com.google.common.annotations.VisibleForTesting) ConfigStore(io.confluent.ksql.rest.server.computation.ConfigStore) Collections(java.util.Collections) ProcessingLogConfig(io.confluent.ksql.logging.processing.ProcessingLogConfig) Injectors(io.confluent.ksql.statement.Injectors) DisabledKsqlClient(io.confluent.ksql.services.DisabledKsqlClient) KafkaConfigStore(io.confluent.ksql.rest.server.computation.KafkaConfigStore) ServiceContext(io.confluent.ksql.services.ServiceContext) KsqlConfig(io.confluent.ksql.util.KsqlConfig) KsqlVersionCheckerAgent(io.confluent.ksql.version.metrics.KsqlVersionCheckerAgent)

Aggregations

ServiceInfo (io.confluent.ksql.ServiceInfo)2 KsqlEngine (io.confluent.ksql.engine.KsqlEngine)2 InternalFunctionRegistry (io.confluent.ksql.function.InternalFunctionRegistry)2 MutableFunctionRegistry (io.confluent.ksql.function.MutableFunctionRegistry)2 SequentialQueryIdGenerator (io.confluent.ksql.query.id.SequentialQueryIdGenerator)2 DisabledKsqlClient (io.confluent.ksql.services.DisabledKsqlClient)2 ServiceContext (io.confluent.ksql.services.ServiceContext)2 VisibleForTesting (com.google.common.annotations.VisibleForTesting)1 KsqlExecutionContext (io.confluent.ksql.KsqlExecutionContext)1 UserFunctionLoader (io.confluent.ksql.function.UserFunctionLoader)1 ProcessingLogConfig (io.confluent.ksql.logging.processing.ProcessingLogConfig)1 ProcessingLogContext (io.confluent.ksql.logging.processing.ProcessingLogContext)1 MetricCollectors (io.confluent.ksql.metrics.MetricCollectors)1 ConfigStore (io.confluent.ksql.rest.server.computation.ConfigStore)1 KafkaConfigStore (io.confluent.ksql.rest.server.computation.KafkaConfigStore)1 KsqlInternalTopicUtils (io.confluent.ksql.rest.util.KsqlInternalTopicUtils)1 KafkaClusterUtil (io.confluent.ksql.services.KafkaClusterUtil)1 ServiceContextFactory (io.confluent.ksql.services.ServiceContextFactory)1 Injector (io.confluent.ksql.statement.Injector)1 Injectors (io.confluent.ksql.statement.Injectors)1