use of org.apache.apex.malhar.sql.planner.RelInfo in project apex-malhar by apache.
the class KafkaEndpoint method populateOutputDAG.
@Override
public RelInfo populateOutputDAG(DAG dag, JavaTypeFactory typeFactory) {
RelInfo spec = messageFormat.populateOutputDAG(dag, typeFactory);
KafkaSinglePortOutputOperator kafkaOutput = dag.addOperator(OperatorUtils.getUniqueOperatorName("KafkaOutput"), KafkaSinglePortOutputOperator.class);
kafkaOutput.setTopic((String) operands.get(KAFKA_TOPICS));
Properties props = new Properties();
props.put(ProducerConfig.VALUE_SERIALIZER_CLASS_CONFIG, VALUE_SERIALIZER);
props.put(ProducerConfig.KEY_SERIALIZER_CLASS_CONFIG, KEY_SERIALIZER);
props.put(ProducerConfig.BOOTSTRAP_SERVERS_CONFIG, operands.get(KAFKA_SERVERS));
kafkaOutput.setProperties(props);
dag.addStream(OperatorUtils.getUniqueStreamName("Formatter", "Kafka"), spec.getOutPort(), kafkaOutput.inputPort);
return new RelInfo("Output", spec.getInputPorts(), spec.getOperator(), null, messageFormat.getRowType(typeFactory));
}
use of org.apache.apex.malhar.sql.planner.RelInfo in project apex-malhar by apache.
the class FileEndpoint method populateInputDAG.
@Override
public RelInfo populateInputDAG(DAG dag, JavaTypeFactory typeFactory) {
LineReader fileInput = dag.addOperator(OperatorUtils.getUniqueOperatorName("FileInput"), LineReader.class);
fileInput.setDirectory((String) operands.get(FILE_INPUT_DIRECTORY));
RelInfo spec = messageFormat.populateInputDAG(dag, typeFactory);
dag.addStream(OperatorUtils.getUniqueStreamName("File", "Parser"), fileInput.output, spec.getInputPorts().get(0));
return new RelInfo("Input", Lists.<Operator.InputPort>newArrayList(), spec.getOperator(), spec.getOutPort(), messageFormat.getRowType(typeFactory));
}
use of org.apache.apex.malhar.sql.planner.RelInfo in project apex-malhar by apache.
the class CSVMessageFormat method populateOutputDAG.
@Override
public RelInfo populateOutputDAG(DAG dag, JavaTypeFactory typeFactory) {
CsvFormatter formatter = dag.addOperator(OperatorUtils.getUniqueOperatorName("CSVFormatter"), CsvFormatter.class);
formatter.setSchema((String) operands.get(CSV_SCHEMA));
return new RelInfo("CSVFormatter", Lists.<Operator.InputPort>newArrayList(formatter.in), formatter, formatter.out, getRowType(typeFactory));
}
use of org.apache.apex.malhar.sql.planner.RelInfo in project apex-malhar by apache.
the class CSVMessageFormat method populateInputDAG.
@Override
public RelInfo populateInputDAG(DAG dag, JavaTypeFactory typeFactory) {
CsvParser csvParser = dag.addOperator(OperatorUtils.getUniqueOperatorName("CSVParser"), CsvParser.class);
csvParser.setSchema((String) operands.get(CSV_SCHEMA));
return new RelInfo("CSVParser", Lists.<Operator.InputPort>newArrayList(csvParser.in), csvParser, csvParser.out, getRowType(typeFactory));
}
use of org.apache.apex.malhar.sql.planner.RelInfo in project apex-malhar by apache.
the class FileEndpoint method populateOutputDAG.
@Override
public RelInfo populateOutputDAG(DAG dag, JavaTypeFactory typeFactory) {
RelInfo spec = messageFormat.populateOutputDAG(dag, typeFactory);
GenericFileOutputOperator.StringFileOutputOperator fileOutput = dag.addOperator(OperatorUtils.getUniqueOperatorName("FileOutput"), GenericFileOutputOperator.StringFileOutputOperator.class);
fileOutput.setFilePath((String) operands.get(FILE_OUT_PATH));
fileOutput.setOutputFileName((String) operands.get(FILE_OUT_NAME));
dag.addStream(OperatorUtils.getUniqueStreamName("Formatter", "File"), spec.getOutPort(), fileOutput.input);
return new RelInfo("Output", spec.getInputPorts(), spec.getOperator(), null, messageFormat.getRowType(typeFactory));
}
Aggregations