Epo 1 Posted June 2, 2020 Hi, I want use a pipeline. The only peculiarity is that in the first stage, there is only on item in the input but many in the output collection. But in the stage one, when it insert the first output, the exception 'Adding to completed collection'" occurs. Although the Input.CompleteAdding statement was not sent. Something is wrong certainly but where ? Thanks for help, Eddy Simplified case below (using Delphi 10.4/ Omnithread 3.07.08) procedure TForm1.Button1Click(Sender: TObject); begin PipelineExecute('1,2,3,4,6,10'); end; procedure TForm1.PipelineExecute(const sMes: string); var ppl: IOmniPipeline; Value: TOmniValue; begin ppl := Parallel.Pipeline .Stage(StageOne) .Stage(StageTwo) .run; ppl.Input.Add(sxmlMes); // ppl.Input.CompleteAdding; end; procedure TForm1.StageOne(const input, output: IOmniBlockingCollection); var s: string; OmVal: TOmniValue; arS: TArray<string>; i: Integer; begin input.Take(OmVal); // 0 arS := SplitString(OmVal.AsString,','); for i := 0 to Length(arS) -1 do Output.Add( StrToInt(ars[i])* 2); end; procedure TForm1.StageTwo(const input, output: IOmniBlockingCollection); var i: Integer; OmVal: TOmniValue; begin for OmVal in input do begin //....... output.Add(omval) ; end; end; Share this post Link to post
Primož Gabrijelčič 223 Posted June 2, 2020 Your pipeline is a local variable in `TForm1.PipelineExecute`. When this method exits, `ppl` goes out of scope and is destroyed. Put the pipeline in a form field. Share this post Link to post
Epo 1 Posted June 2, 2020 Yes, of course... (it works) Great thanks for the help and ....the library. Share this post Link to post