The wrapper only ensures that tuples are emitted according the their
timestamp attribute. You need to write the actual CSV reading spout by
yourself.

The simplest way is to instantiate a BufferedReader in the spout's
open() method and read + parse a single line from the reader each time
nextTuple() is called. (As long as the reader does not return NULL).

You can either configure the file name via constructor or as an
alternative you can configure the BufferedReader (ie, the file name)
using Storms Config/Map parameter in open and instantiate the
BufferedReader there. When building the topology, you can set the
filename and add it to the configuration given to submitTopology() method.

you would plug it together like:

builder.setSpout("spout", new DataDrivenStreamRateDriverSpout(new
CSVReaderSpout("/path/to/csv/file"), 0,
DataDrivenStreamRateDriverSpout.TIME_UNIT.MICROSECONDS));

where "0" is the index of the timestamp attribute within the CSV records
an the timestamp values a provided in micro-seconds.



-Matthias




On 05/12/2015 01:03 PM, anshu shukla wrote:
> Thanks alot  for help,
> But sir  i am not gettig how to give input file to spout .Should i write
> the code for reading CSV file  with timesyamp in each .
> Sorry if m not up to the mark .Please  give more details  about  working
> etc.
> 
> On Mon, May 11, 2015 at 4:49 PM, Matthias J. Sax
> <[email protected] <mailto:[email protected]>>
> wrote:
> 
>     Hi Anshu,
> 
>     I had the same problem once and wrote the following Spout for it:
> 
>     
> https://github.com/mjsax/aeolus/blob/master/queries/utils/src/main/java/de/hub/cs/dbis/aeolus/queries/utils/DataDrivenStreamRateDriverSpout.java
> 
>     It is a wrapper to the Spout that actually emit the tuples. Basically,
>     my wrapper throttles the emit speed of the spout that is wrapped.
> 
> 
>     Feel free to use it. Feedback is welcome.
> 
> 
> 
>     -Matthias
> 
> 
> 
>     On 05/11/2015 10:50 AM, anshu shukla wrote:
>     > I have the real DEBS-TAxi data in csv file , in order to operate
>     over it
>     > how to simulate a "Spout" kind  of thing as event generator using the
>     > timestamps in CSV file.
>     >
>     >
>     
> http://stackoverflow.com/questions/30149868/generate-events-tuples-using-csv-file-with-timestamps
>     > --
>     > Thanks & Regards,
>     > Anshu Shukla
> 
> 
> 
> 
> -- 
> Thanks & Regards,
> Anshu Shukla

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to