use of org.apache.apex.malhar.contrib.enrich.JsonFSLoader in project apex-malhar by apache.
the class EnricherAppWithJSONFile method populateDAG.
@Override
public void populateDAG(DAG dag, Configuration conf) {
dataGenerator = dag.addOperator("DataGenerator", DataGenerator.class);
JsonParser parser = dag.addOperator("Parser", JsonParser.class);
/**
* FSLoader is used to configure Enricher backend. Property of FSLoader file which is fileName is set in
* properties.xml file.
* The format that is used to read the file is present as an example in resources/circleMapping.txt file.
*/
JsonFSLoader fsLoader = new JsonFSLoader();
POJOEnricher enrich = dag.addOperator("Enrich", POJOEnricher.class);
enrich.setStore(fsLoader);
ArrayList<String> includeFields = new ArrayList<>();
includeFields.add("circleName");
ArrayList<String> lookupFields = new ArrayList<>();
lookupFields.add("circleId");
enrich.setIncludeFields(includeFields);
enrich.setLookupFields(lookupFields);
MapFunctionOperator<Object, ?> out = dag.addOperator("out", new MapFunctionOperator<>(outputFn));
dag.addStream("Parse", dataGenerator.output, parser.in);
dag.addStream("Enrich", parser.out, enrich.input);
dag.addStream("Console", enrich.output, out.input);
}
Aggregations