I have a blockingcollection.
private BlockingCollection<Tuple<ChannelResource, string>> bc;
Now I want to process each item in it.
private bool ProcessEachChannel(Tuple<ChannelResource, string> workItem) { ChannelResource cr = workItem.Item1; string sipuri = workItem.Item2; VoiceResource vr = workItem.Item1.VoiceResource; bool success=false; try {
I don't know how to get the return bool value in the ActionBlock code.
internal void SimultaneousCall() { var workItemBlock = new ActionBlock<Tuple<ChannelResource, string>>( workItem => { ProcessEachChannel(workItem); }); foreach (var workItem in bc.GetConsumingEnumerable()) { workItemBlock.Post(workItem); } workItemBlock.Complete(); }
You see that there are two lines code, I am not sure whether I get the bool value from
ProcessEachChannel(workItem); // I mean bool b= ProcessEachChannel(workItem);
Or from
workItemBlock.Post(workItem); // I mean bool b = workItemBlock.Post(workItem);
Eventually I want to get the statistics of how many success or fail. Sorry fr the stupid question.