Reputation: 73
I designed a complex dataflow consisting of various DataBlocks. I send a packet into the flow and receive a result on the end.
I work with
input.Post();
input.Complete();
// and later with
ReceiveAsync();
For the first call all works fine, but I don't know how to send the second data-packet through into the flow graph.
Inside the graph I also must use a WriteOnceBlock
, can this be a problem for call the flow twice times?
Upvotes: 1
Views: 262
Reputation: 28355
You cannot use any of TPL Dataflow
blocks after you've called the Complete
method for them or for those who linked to them with completion propagation. So either you need to recreate your pipeline for each of your call, or (which is preferred) not to call Complete
just for a one call.
Suggestions to your design:
Post/Receive
methods in your pipeline, which can be substitute by linking the blocks. Moreover, you can use the completion propagation for this, so you'll remove all the continuation handlers in your code, if any.WriteOnceBlock
? You can switch it to Broadcast
, so you still has a value for a data, but it can be overridden by next call.WriteOnceBlock
either by specifying the MaxMessages
for linked blocks or by storing the IDisposable
result of the LinkTo
method so you can remove it for your next call, and create a new one WriteOnceBlock
.Upvotes: 2