Database Reference
In-Depth Information
String strLine;
try {
while ((strLine = br.readLine()) != null) {
qe.add((new
StringBuilder(String.valueOf(strLine))).append("#@#" +
getMsgId(msgId)).toString());
msgId++;
}
} catch (IOException e) {
e.printStackTrace();
} catch (Exception e) {
e.printStackTrace();
}
}
//function to read line from file at specified location
private void readFile() {
try {
FileInputStream fstream = new FileInputStream("/
home/mylog"); in = new DataInputStream(fstream);
br = new BufferedReader(new InputStreamReader( in
));
queueIt();
System.out.println("FileSpout file reading done");
} catch (FileNotFoundException e) {
e.printStackTrace();
}
}
//open function that is called at the time of spout
initialization
// it calls the readFile method that reads the file ,
adds events
// to the linked list to be fed to the spout as tuples
@
Override
public void open(Map conf, TopologyContext context,
SpoutOutputCollector collector) {
_collector = collector;
Search WWH ::




Custom Search