use of org.talend.components.kafka.runtime.IKafkaDatasetRuntime in project components by Talend.
the class KafkaDatasetProperties method beforeTopic.
public ValidationResult beforeTopic() {
KafkaDatasetDefinition definition = new KafkaDatasetDefinition();
RuntimeInfo runtimeInfo = definition.getRuntimeInfo(this);
try (SandboxedInstance sandboxedInstance = RuntimeUtil.createRuntimeClass(runtimeInfo, getClass().getClassLoader())) {
IKafkaDatasetRuntime runtime = (IKafkaDatasetRuntime) sandboxedInstance.getInstance();
runtime.initialize(null, this);
this.topic.setPossibleValues(new ArrayList(runtime.listTopic()));
return ValidationResult.OK;
} catch (Exception e) {
return new ValidationResult(new ComponentException(e));
}
}
Aggregations