0

I need to queue and run multiple jobs in a background service, simultaneously. I have a Job object that will poll various FTP sites, download files etc. I'd like to load all my Jobs and run them in parallel. I believe I can use IHostedServer and IBackgroundTaskQueue. Like this ASP .Net Core Queued background tasks parallel processing

How do I queue my Jobs up and run them? Something like this? Is this the correct approach? Loop thru my collection of jobs and 'execute'? A workitem?

public Task StartAsync(CancellationToken cancellationToken)
    {      
       foreach (var job in Jobs)
        {
            var executorTask = new Task(
                async () =>
                {
              ???
Peter Csala
  • 17,736
  • 16
  • 35
  • 75
Jon
  • 1,608
  • 7
  • 25
  • 38

0 Answers0