Is it possible to get TransformManyBlock
s to send intermediate results as they are created to the next step instead if waiting for the entire IEnumerable<T>
to be filled?
All testing I've done shows that TransformManyBlock
only sends a result to the next block when it is finished; the next block then reads those items one at a time.
It seems like basic functionality but I can't find any examples of this anywhere.
The use case is processing chunks of a file as they are read. In my case there's a modulus of so many lines needed before I can process anything so a direct stream won't work.
They kludge I've come up with is to create two pipelines:
a "processing" dataflow network the processes the chunks of data as the become available
"producer" dataflow network that ends where the file is broken into chunks then posted to the start of the "processing" network that actually transforms the data.
The "producer" network needs to be seeded with the starting point of the "processing" network.
Not a good long term solution since additional processing options will be needed and it's not flexible.
Is it possible to have any dataflow block type to send multiple intermediate results as created to a single input? Any pointers to working code?
TransformManyBlock
, that was discovered by someone who was probably using this block in the same way that you are trying to use it yourself. TPL Dataflow: Why does EnsureOrdered = false destroy parallelism for this TransformManyBlock? – ChaneTranformManyBlock
doesn't behave that way. I don't have to test it, I often process files with thousands of files that way. This block for example would emit lines as it read them :new TransformBlock<string,string>(path=>File.ReadLines(path))
– Doubleheader