Open gamorav opened 2 years ago
Hi @gamorav,
One easier approach to solving this would be, listening to the directory instead of the file.
@source(type='file',dir.uri = "file:/C:/Users/admin/Documents/test",mode = "TEXT.FULL",tailing = "false",header.present = "false",
@map(type='csv'))
define stream input_stream (name string,amount double);
Upon dropping a new CSV file (with a new name) to your file:/C:/Users/admin/Documents/test
directory, the input_stream
will read the lines from it.
Will this work for you?
Hi @gamorav, One easier approach to solving this would be, listening to the directory instead of the file.
@source(type='file',dir.uri = "file:/C:/Users/admin/Documents/test",mode = "TEXT.FULL",tailing = "false",header.present = "false", @map(type='csv')) define stream input_stream (name string,amount double);
Upon dropping a new CSV file (with a new name) to your
file:/C:/Users/admin/Documents/test
directory, theinput_stream
will read the lines from it. Will this work for you?
Hi @senthuran16 , thank you, but I need that the csv has to be the same name, any workaround for that condition?.
Hi @gamorav ,
We can use file.uri
with mode = "LINE"
, and tailing = "TRUE"
[1], to achieve this.
@source(type='file', file.uri = "file:/C:/Users/admin/Documents/test/productions.csv", mode = "LINE", tailing = "true", header.present = "false",
@map(type='csv'))
define stream input_stream (name string,amount double);
When we add a new line to productions.csv
file and save that, the input_stream
will receive a new event.
[1] https://siddhi-io.github.io/siddhi-io-file/api/latest/#file-source
Description: I am using WSO2 Streaming Integrator Tooling 4.0.0 to test this script:
Log:
My problem is that when I overwrite the csv file with new data the log doesn't show anything. The only way to do that is by saving the siddhi file.
How can I solve this issue?. In other words, How can I automatically poll the entire file (not line by line) every time it is modified or overwritten?
Thanks.