use of org.apache.apex.malhar.sql.planner.RelInfo in project apex-malhar by apache.
the class KafkaEndpoint method populateInputDAG.
@Override
public RelInfo populateInputDAG(DAG dag, JavaTypeFactory typeFactory) {
KafkaSinglePortInputOperator kafkaInput = dag.addOperator(OperatorUtils.getUniqueOperatorName("KafkaInput"), KafkaSinglePortInputOperator.class);
kafkaInput.setTopics((String) operands.get(KAFKA_TOPICS));
kafkaInput.setInitialOffset("EARLIEST");
Properties props = new Properties();
props.put(ConsumerConfig.BOOTSTRAP_SERVERS_CONFIG, operands.get(KAFKA_SERVERS));
props.put(ConsumerConfig.KEY_DESERIALIZER_CLASS_CONFIG, KEY_DESERIALIZER);
props.put(ConsumerConfig.VALUE_DESERIALIZER_CLASS_CONFIG, VALUE_DESERIALIZER);
kafkaInput.setConsumerProps(props);
kafkaInput.setClusters((String) operands.get(KAFKA_SERVERS));
RelInfo spec = messageFormat.populateInputDAG(dag, typeFactory);
dag.addStream(OperatorUtils.getUniqueStreamName("Kafka", "Parser"), kafkaInput.outputPort, spec.getInputPorts().get(0));
return new RelInfo("Input", Lists.<Operator.InputPort>newArrayList(), spec.getOperator(), spec.getOutPort(), messageFormat.getRowType(typeFactory));
}
Aggregations