Post DataflowBlock<T> ( )
, ,
, ( , ).
, :
, , , Post, SendAsync, SendAsync.
, ( ) , , , .
, BoundedCapacity BufferBlock<T> < href= "http://msdn.microsoft.com/en-us/library/hh194684.aspx" > ActionBlock<TInput> - , :
BufferBlock<T> 10000; , 10 000 , (. ), (SendAsync , , ).
ActionBlock<TInput> 1, .
10000 + (1 * 3) = 10000 + 3 = 10,003
, .
MaxDegreeOfParallelism ExecutionDataFlowBlockOptions ActionBlock<TInput>.
ActionBlock<TInput> MaxDegreeOfParallelism 1; , , . , ActionBlock<T> , .
ActionBlock<TInput> , , MaxDegreeOfParallelism DataflowBlockOptions.Unbounded.
, - ActionBlock<TInput>, , , , .
- , , , MaxDegreeOfParallelism.
-, , BoundedCapacity.
, " , - "; , , , . , .
, , . :
var delimitedFileBlock = new BufferBlock<string>();
Action<string> action =
s => { };
var solaceActionBlock1 = new ActionBlock<string>(action,
new ExecutionDataflowBlockOptions {
MaxDegreeOfParallelism = DataflowBlockOptions.Unbounded,
});
var solaceActionBlock2 = new ActionBlock<string>(action,
new ExecutionDataflowBlockOptions {
MaxDegreeOfParallelism = DataflowBlockOptions.Unbounded,
});
var solaceActionBlock3 = new ActionBlock<string>(action,
new ExecutionDataflowBlockOptions {
MaxDegreeOfParallelism = DataflowBlockOptions.Unbounded,
});
delimitedFileBlock.LinkTo(solaceTargetBlock1);
delimitedFileBlock.LinkTo(solaceTargetBlock2);
delimitedFileBlock.LinkTo(solaceTargetBlock3);
while (!eof)
{
string row = ...;
delimitedFileBlock.Post(read);
}
, ActionBlock<TInput> , ( ), ( , MaxDegreeOfParallelism Unbounded):
var delimitedFileBlock = new BufferBlock<string>();
Action<string> action =
s => { };
var solaceActionBlock1 = new ActionBlock<string>(action,
new ExecutionDataflowBlockOptions {
MaxDegreeOfParallelism = DataflowBlockOptions.Unbounded,
});
delimitedFileBlock.LinkTo(solaceTargetBlock);
while (!eof)
{
string row = ...;
delimitedFileBlock.Post(read);
}