public void build() {
init();
LazyPlume plume = new LazyPlume();
// Get input files
PCollection inputEvent2, inputLogFile, inputLogFile2;
try {
inputEvent2 = plume.readFile(inputPathEvent2, collectionOf(strings()));
inputLogFile2 = plume.readFile(inputPathLogFile2, collectionOf(strings()));
inputLogFile = plume.readFile(inputPathLogFile, collectionOf(strings()));
// Add as inputs
addInput(inputEvent2);
addInput(inputLogFile);
} catch (IOException e) {
throw new RuntimeException();
}
/**
* Emit the user of the log file - flatten it with users file
*/
PCollection output = plume.flatten(collectionOf(strings()),
inputEvent2,
inputLogFile.map(new DoFn<Text, Text>() {
@Override
public void process(Text v, EmitFn<Text> emitter) {
String[] splittedLine = v.toString().split("\t");
emitter.emit(new Text(splittedLine[2]));
}
}, collectionOf(strings())));
/**
* Flatten two log files
*/
PCollection output2 = plume.flatten(collectionOf(strings()),
inputLogFile2,
inputLogFile);
addOutput(output);
addOutput(output2);