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);
}
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);
}
Aggregations