ParallelBatchProcessor 2.0.2

dotnet add package ParallelBatchProcessor --version 2.0.2
NuGet\Install-Package ParallelBatchProcessor -Version 2.0.2
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="ParallelBatchProcessor" Version="2.0.2" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add ParallelBatchProcessor --version 2.0.2
#r "nuget: ParallelBatchProcessor, 2.0.2"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install ParallelBatchProcessor as a Cake Addin
#addin nuget:?package=ParallelBatchProcessor&version=2.0.2

// Install ParallelBatchProcessor as a Cake Tool
#tool nuget:?package=ParallelBatchProcessor&version=2.0.2

What does it do?

A library that makes it easy for developes to process a list of items in parallel in a Console application. Source code can be enhanced to use it in other types of applications, but there are no classes to support it out-of-the-box yet.

Usage Examples

Example 1: Synchronous method to process one record

using System.Linq;
using System.Threading;
using ParallelBatchProcessor;
using ParallelBatchProcessor.Processors;
using ParallelBatchProcessor.Runner.ProgressStorage;

public class Demo : IProcessor<int>
{
    public void Run()
    {
        // list of ids to process
        var ids = Enumerable.Range(1, 100).ToList();

        int threadCount = 3;
        var processor = this;
        var progressFileName = "c:\\temp\\processed.txt";
        var progressStorage = new ProgressFileStorage<int>(progressFileName);

        var consoleExecutor = new ConsoleExecutor();
        consoleExecutor.Process(threadCount, ids, processor, progressStorage);
    }

    /// <summary>
    /// Implement logic for processing one record
    /// </summary>
    /// <returns>
    /// `True` if success, `False` if failed. 
    /// Failed items will be not persisted to `IProgressStorage<T>` as processed. 
    /// They will be processed again on next run.
    /// </returns>
    public bool Process(int id)
    {
        Thread.Sleep(1000);
        return true;
    }
}

Example 2: Asynchronous method to process one record

using ParallelBatchProcessor;
using ParallelBatchProcessor.Processors;
using ParallelBatchProcessor.Runner.ProgressStorage;
using System.Linq;
using System.Threading.Tasks;

public class Demo : IProcessorAsync<int>
{
    public void Run()
    {
        // list of ids to process
        var ids = Enumerable.Range(1, 100).ToList();

        int threadCount = 3;
        var processor = this;
        var progressFileName = "c:\\temp\\processed.txt";
        var progressStorage = new ProgressFileStorage<int>(progressFileName);

        var consoleExecutor = new ConsoleExecutor();
        consoleExecutor.Process(threadCount, ids, processor, progressStorage);
    }

    /// <summary>
    /// Implement logic for processing one record
    /// </summary>
    /// <returns>
    /// `True` if success, `False` if failed. 
    /// Failed items will be not persisted to `IProgressStorage<T>` as processed. 
    /// They will be processed again on next run.
    /// </returns>
    public async Task<bool> ProcessAsync(int id)
    {
        await Task.Delay(1000);
        return true;
    }
}

Version History

Version 2.0.0:

  • Upgraded to target .NET Core 3.1 Framework
  • Added support for async functions to process a one record

Version 1.0.1:

  • First public version
  • Supports only sync functions to process a one record
  • .NET 4.8 Framework
Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
.NET Core netcoreapp3.1 is compatible. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • .NETCoreApp 3.1

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
2.0.2 158 7/22/2023
2.0.1 139 7/22/2023
2.0.0 138 7/22/2023
1.0.1 259 11/3/2021
1.0.0 281 11/3/2021