LogoLogo
HomePricingDocumentation
  • 💿Getting Started
    • Installation and Project Setup
    • Hello Perigee!
    • Perigee Application Design
    • Hello Configuration
    • Hello Logs
    • Hello Integration
    • Troubleshooting
    • Case Studies
  • 📃License + Notice
    • 📂Licensing
    • Notice of Third Party Agreements
  • 🚀Perigee and Beyond
    • Extending - Threads
    • Extending - Loaders
    • ⏳All about CRON
  • 🔮API Generation
    • What is API Generation?
    • API Builder
  • 🗺️Architecting YOUR App
    • Design and Requirements
    • Define Sources
    • Requirements
  • 🧩Core Modules
    • 🌐PerigeeApplication
    • 🪡Thread Registry
    • Event Sources
      • Scheduled/Logic
        • CRON Thread
        • Scheduler
        • Sync Agent
      • Watchers
        • SalesForce
        • Sharepoint
        • Directory Watch
        • Directory Notifier
        • IMAP
    • Credential Management
      • Connection Strings
      • Custom Refresh Logic
      • RestSharp Authenticator
      • Credential Store SDK
      • ⁉️Troubleshooting Credentials
    • Integration Utilities
      • HTTP(S) - RestSharp
      • Transaction Coordinator
      • Limiter
      • Watermarking
    • Alert Managers
      • SMS
      • Email
      • Discord
      • Teams
    • File Formats
      • Excel
      • CSV
    • 📁File System Storage
      • File Revision Store
      • Concurrent File Store
      • FileSync + Cache
    • Third Party
      • SmartSheets
      • Microsoft Graph
    • Perigee In Parallel
      • Parallel Processing Reference
      • Extensions
      • GroupProcessor
      • SingleProcessor
    • 🧱Utility Classes
      • Metrics
      • F(x) Expressions
      • Multi-Threaded Processor (Scatter Gather)
      • OpenAI - GPT
      • XML Converter
      • Dynamic Data Table
      • Debounce
      • Thread Conditions
      • Perigee Utility Class
      • Network Utility
      • Lists
      • FileUtil
      • Inclusive2DRange
      • Strings, Numbers, Dates
      • Nested Sets
      • Behavior Trees
      • JsonCompress
      • Topological Sorting
      • DBDownloader
    • 🈁Bit Serializer
  • 📣Examples and Demos
    • API + Perigee
    • 📰Excel Quick Load
    • SalesForce Watcher
    • Report Scheduler
    • Agent Data Synchronization
    • 📩IMAP Echo bot
    • Watch and load CSVs
    • Graph Delegated Authorization + DataVerse
    • Coordinator Demo
    • Azure Service Bus
    • QuickBooks Online
  • 📘Blueprints
    • Perigee With .NET Hosting
    • Web Host Utilities
    • 🔌Plugin Load Context
  • 🎞️Transforms
    • 🌟What is Transforms?
    • 📘Terminology
    • 🦾The Mapping Document
    • 👾Transformation Process
    • 😎Profile
    • 🎒Automation
      • 🕓Package Options
      • 🔳Configuration
    • 🔧Utilities
      • 🧹Clean
      • 📑Map File
      • 🔎File Identification
      • 🗺️Map Generation
      • 🪅Insert Statement Generation
  • 🗃️Transform SDK
    • 👋Quick Start Guide
    • 🥳MapTo
    • 🔌Authoring Plugins
      • 🔘File IO Process
      • 📢Data Quality
      • 🟢Transform Process
    • SDK Reference
      • 🔘FileIOProcessData
      • 📢DataQualityContext
      • 🎛️TransformDataContext
      • 🏅TransformResult
Powered by GitBook
On this page
  • ParallelProcess
  • ParallelProcessToBag
  • ParallelProcessToDictionary
  • ParallelProcessKeys
  • ParallelProcessKeysToBag
  • ParallelProcessKeysToDictionary
  • ParallelToNewSingleProcessor
  • ParallelToNewGroupedProcessor
  • AllKeys
Export as PDF
  1. Core Modules
  2. Perigee In Parallel

GroupProcessor

PreviousExtensionsNextSingleProcessor

Last updated 1 year ago

The GroupProcessor class is a generic class that provides parallel processing functionality for collections of elements. It allows users to easily perform parallel operations on a group of items and return the results as different types of collections, such as ConcurrentBag, ConcurrentDictionary, or a List.

The "Group" Processor is for a selection where more than one item can be matched for the given selector, also known as a GroupBy. If you're looking for a single item in and out without grouping, use the .

ParallelProcess

This method processes the collection in parallel and invokes the provided callback for each group of items with the same key.

Example:

var groupProcessor = new GroupProcessor<Item, Category>(items, item => item.Category);
groupProcessor.ParallelProcess((group, category) => {
    Console.WriteLine($"Processing category: {category}");
    foreach (var item in group)
    {
        Console.WriteLine($"  - {item.Name}");
    }
});

ParallelProcessToBag

This method processes the collection in parallel and adds the results to a ConcurrentBag by invoking the provided callback for each group of items with the same key.

Example:

var groupProcessor = new GroupProcessor<Item, Category>(items, item => item.Category);
ConcurrentBag<string> resultBag = groupProcessor.ParallelProcessToBag((group, category) => {
    int itemCount = group.Count;
    return $"Category: {category}, Item Count: {itemCount}";
});

ParallelProcessToDictionary

This method processes the collection in parallel and adds the results to a ConcurrentDictionary by invoking the provided callback for each group of items with the same key.

Example:

var groupProcessor = new GroupProcessor<Item, Category>(items, item => item.Category);
ConcurrentDictionary<Category, int> resultDictionary = groupProcessor.ParallelProcessToDictionary((group, category) => {
    int itemCount = group.Count;
    return new KeyValuePair<Category, int>(category, itemCount);
});

ParallelProcessKeys

This method processes the keys of the collection in parallel and invokes the provided callback for each key.

Example:

var singleProcessor = new SingleProcessor<Item, Category>(items, item => item.Category);
singleProcessor.ParallelProcessKeys(key => {
    Console.WriteLine($"Processing key: {key}");
});

ParallelProcessKeysToBag

This method processes the keys of the collection in parallel and adds the results to a ConcurrentBag by invoking the provided callback for each key.

Example:

var singleProcessor = new SingleProcessor<Item, Category>(items, item => item.Category);
ConcurrentBag<string> resultBag = singleProcessor.ParallelProcessKeysToBag(key => {
    return $"Key: {key}";
});

ParallelProcessKeysToDictionary

This method processes the keys of the collection in parallel and adds the results to a ConcurrentDictionary by invoking the provided callback for each key.

Example:

var singleProcessor = new SingleProcessor<Item, Category>(items, item => item.Category);
ConcurrentDictionary<Category, int> resultDictionary = singleProcessor.ParallelProcessKeysToDictionary(key => {
    return new KeyValuePair<Category, int>(key, 1);
});

ParallelToNewSingleProcessor

This method processes the keys of the collection in parallel and returns a new SingleProcessor instance containing the results.

Example:

var singleProcessor = new SingleProcessor<Item, Category>(items, item => item.Category);
SingleProcessor<string, Category> newSingleProcessor = singleProcessor.ParallelToNewSingleProcessor(key => {
    return new KeyValuePair<Category, string>(key, $"New {key}");
});

ParallelToNewGroupedProcessor

This method processes the keys of the collection in parallel and returns a new GroupProcessor instance containing the results, grouped by the provided expression.

Example:

var singleProcessor = new SingleProcessor<Item, Category>(items, item => item.Category);
GroupProcessor<string, Category> newGroupProcessor = singleProcessor.ParallelToNewGroupedProcessor(key => {
    return new KeyValuePair<Category, string>(key, $"New {key}");
}, group => group.Category);

AllKeys

Returns all keys in the processor as an enumerable.

Example:

var allKeys = processor.AllKeys();
foreach (var key in allKeys)
{
    Console.WriteLine(key);
}
🧩
SingleProcessor