Jump to content
Sign in to follow this  
PatV

Task message

Recommended Posts

Hi All,

 

I'm trying to get message in my main thread from a task inside a procedure inside a pipeline without success.

 

    FPipeline := Parallel.Pipeline;
    FPipeline.Stage(AccountsGl_SearchSuggested)
             .Stage(AccountsGl_TryGet , Parallel.TaskConfig.OnMessage(TaskMessage))
             .Run
             .Input.Add(TOmniValue.FromArray<rImport>(Items));
    FPipeline.Input.CompleteAdding;

In my procedure AccountsGl_TryGet I have this ;

 

procedure TFImport.AccountsGl_TryGet(const input, output: IOmniBlockingCollection;  const task: IOmniTask);
var
  aValue : TOmniValue;
begin
    for aValue in input do begin
      if task.CancellationToken.IsSignalled then
        break;
      AccountGl_GetSuggested(aValue.ToRecord<rImport>);
    end;
end;

and in AccountsGL_GetSuggested I have

 

procedure TFImport.AccountGl_GetSuggested(const aSearch : rImport);
var
 iTask : IOmniTaskControl;
begin

 iTask := CreateTask(WorkerGetAccountSuggested, clsConnectionPool.GetTGUIDString )
      .OnMessage(TaskMessage)
      .OnTerminated(TaskTerminated)
      .SetParameter('Msg' ,MSG_GET_ACCOUNTSUGGEST)
      .Schedule(FDbPool);
end;

from workerGetAccountSuggested I have the following call

  if not task.Terminated then
  begin
     aOVValue := TOmniValue.FromRecord<rAccountGl>(aValue);
     task.Comm.Send(task.Param['Msg'],aOVValue);
  end;
       

So, the message ( task.Comm.Send(task.Param['Msg'],aOVValue) )  from iTask in the procedure AccountsGL_GetSuggested never achieve the TaskMessage procedure.

 

Do you have any clues ?

 

Regards

 

Patrick

 

 

 

 

 

 

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  
×