storm-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Bilal Al Fartakh <alfartaj.bi...@gmail.com>
Subject Re: Output of storm topology?
Date Tue, 27 May 2014 15:46:25 GMT
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 <hamza.asad13@gmail.com>:

> 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 <
> alfartaj.bilal@gmail.com> 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 <hamza.asad13@gmail.com>:
>>
>> 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 <hamza.asad13@gmail.com>wrote:
>>>
>>>>
>>>>
>>>> ---------- Forwarded message ----------
>>>> From: Hamza Asad <hamza.asad13@gmail.com>
>>>> Date: Tue, May 27, 2014 at 1:34 PM
>>>> Subject: Output of storm topology?
>>>> To: user@storm.incubator.apache.org
>>>>
>>>>
>>>> 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*

Mime
View raw message