I used as you see the Basicoutputcollector
and the path to the file we want to save is set here :
output = new BufferedWriter(new FileWriter("/root/src/storm-starter/hh.txt",
true));
and what do you mean about locally ? can you show me the error so I or
another member can detect the problem , and if it's possible send me the
code .
2014-05-27 16:39 GMT+01:00 Hamza Asad <[email protected]>:
> I have tested that, Spout is working fine and populating file BUT bolts
> Output is not logging into desired output file locally.. Why? Any idea why
> this is happening? Does Bolt write in a file located on local system? Is
> there any specific outputCollector for that?
>
>
> On Tue, May 27, 2014 at 1:49 PM, Bilal Al Fartakh <
> [email protected]> wrote:
>
>> HI hamza !
>> if you want to see the result you can try programming your bolt to save
>> results emitted from the spout/bolt on a file .
>> as example :
>>
>>
>> PrinterBolt :
>>
>>
>>
>> package storm.starter;
>>
>> import backtype.storm.topology.BasicOutputCollector;
>> import backtype.storm.topology.OutputFieldsDeclarer;
>> import backtype.storm.topology.base.BaseBasicBolt;
>> import backtype.storm.tuple.Tuple;
>> import java.io.File;
>> import java.io.BufferedWriter;
>> import java.io.FileNotFoundException;
>> import java.io.FileWriter;
>> import java.io.IOException;
>>
>>
>>
>>
>>
>> public class PrinterBolt extends BaseBasicBolt {
>>
>> @Override
>> public void execute(Tuple tuple, BasicOutputCollector collector) {
>>
>> try {
>> BufferedWriter output;
>> output = new BufferedWriter(new
>> FileWriter("/root/src/storm-starter/hh.txt", true));
>> output.newLine();
>> output.append(tuple.getString(0));
>> output.close();
>> } catch (IOException e) {
>> // TODO Auto-generated catch block
>> e.printStackTrace();
>> }
>>
>> }
>>
>> @Override
>> public void declareOutputFields(OutputFieldsDeclarer ofd) {
>> }
>>
>> }
>>
>>
>>
>>
>>
>>
>>
>>
>> ------------------------------------------------------------------------------------------------------------
>>
>>
>> then add your bolt to the main class topology
>>
>>
>> TopologyBuilder builder = new TopologyBuilder();
>>
>> PrinterBolt P = new PrinterBolt();
>> builder.setSpout("word", new hhhhh( ), 1);
>> builder.setBolt("exclaim1", new ExclamationBolt(),
>> 3).shuffleGrouping("word");
>> builder.setBolt("exclaim2", P , 2).shuffleGrouping("exclaim1");
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>> 2014-05-27 9:42 GMT+01:00 Hamza Asad <[email protected]>:
>>
>> Respected All,
>>> I'm new to storm, started working on it of my own as i'm impressed by
>>> the features it is providing. I have successfully deployed storm, run
>>> wordcount example. But i want to see the result. Either on a web UI or in a
>>> file. How can i do that? Please help me as it is very necessary to validate
>>> my future implementation results.
>>>
>>> Regards
>>>
>>>
>>> On Tue, May 27, 2014 at 1:41 PM, Hamza Asad <[email protected]>wrote:
>>>
>>>>
>>>>
>>>> ---------- Forwarded message ----------
>>>> From: Hamza Asad <[email protected]>
>>>> Date: Tue, May 27, 2014 at 1:34 PM
>>>> Subject: Output of storm topology?
>>>> To: [email protected]
>>>>
>>>>
>>>> Respected All,
>>>> I'm new to storm, started working on it of my own as i'm impressed by
>>>> the features it is providing. I have successfully deployed storm, run
>>>> wordcount example. But i want to see the result. Either on a web UI or in a
>>>> file. How can i do that? Please help me as it is very necessary to validate
>>>> my future implementation results.
>>>>
>>>> Regards
>>>> --
>>>> *Muhammad Hamza Asad*
>>>>
>>>>
>>>>
>>>> --
>>>> *Muhammad Hamza Asad*
>>>>
>>>
>>>
>>>
>>> --
>>> *Muhammad Hamza Asad*
>>>
>>
>>
>>
>> --
>> *Al Fartakh Bilal*
>>
>
>
>
> --
> *Muhammad Hamza Asad*
>
--
*Al Fartakh Bilal*