Can Dstream with new names be created and older dstream be destroyed on runtime?
//Read the Dstream
inputDstream = ssc.textFileStream("./myPath/")
Example: I am reading a file called cvd_filter.txt in which every single line contains a string which is supposed to be a filter criteria for dstream. This file gets updated(also can be appended) with new values:
Example: At time 10:00 ; cat cvd_filter.txt
"1001"
"1002"
"1003"
// Read cvd_filter.txt every 5 mins and do creation/destruction of dstreams.
with open(cvd_filter.txt) as f:
content = f.readlines()
dstream_content[0] = inputDstream.filter(lambda a: content[0] in a)
// At this point (dstream_1001 , dstream_1002, dstream_1003) should get created.
// NOW, DO SOME OPERATION ON INDIVIDUAL dstreams.
At time 10:05 ; cat cvd_filter.txt
"1004"
"1002"
"1003"
// Create dstream_1004 for new filter string, Destroy dstream_1001 only // but retain dstream_1002 and dstream_1003. At this point (dstream_1004 , dstream_1002, dstream_1003) should be present. // NOW, DO SOME OPERATION ON INDIVIDUAL dstreams.