MeshWeaver.Import 2.3.0

dotnet add package MeshWeaver.Import --version 2.3.0
                    
NuGet\Install-Package MeshWeaver.Import -Version 2.3.0
                    
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="MeshWeaver.Import" Version="2.3.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="MeshWeaver.Import" Version="2.3.0" />
                    
Directory.Packages.props
<PackageReference Include="MeshWeaver.Import" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add MeshWeaver.Import --version 2.3.0
                    
#r "nuget: MeshWeaver.Import, 2.3.0"
                    
#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.
#:package MeshWeaver.Import@2.3.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=MeshWeaver.Import&version=2.3.0
                    
Install as a Cake Addin
#tool nuget:?package=MeshWeaver.Import&version=2.3.0
                    
Install as a Cake Tool

MeshWeaver.Import

MeshWeaver.Import is a powerful module for importing data into the MeshWeaver data ecosystem. It supports complex data import scenarios with distributed processing capabilities, allowing data to be imported, transformed, and distributed across multiple message hubs.

Overview

The library provides:

  • Flexible data import from various sources
  • Support for multiple data types in a single import
  • Distributed processing through message hubs
  • Activity logging and status tracking
  • Data transformation and routing

Architecture

Import Flow

graph TD
    A[Client] -->|ImportRequest| B[Import Hub]
    B -->|Parse Data| C[Data Parser]
    C -->|Route Data| D{Data Router}
    D -->|Reference Data| E[Reference Data Hub]
    D -->|Transactional Data| F[Transactional Hub]
    F -->|Compute| G[Computed Data Hub]
    
    style A fill:#f9f,stroke:#333,stroke-width:2px
    style B fill:#bbf,stroke:#333,stroke-width:2px
    style D fill:#dfd,stroke:#333,stroke-width:2px

Usage Examples

Basic Import

Import reference data (e.g., Lines of Business):

// Define import data
var importData = @"@@LineOfBusiness
SystemName,DisplayName
1,LoB_one
2,LoB_two";

// Create and send import request
var client = GetClient();
var importRequest = new ImportRequest(importData);
var importResponse = await client.AwaitResponse(
    importRequest,
    o => o.WithTarget(new ImportAddress(2024))
);

// Check import status
importResponse.Message.Log.Status.Should().Be(ActivityStatus.Succeeded);

Multiple Types Import

Import multiple data types in a single request:

var multiTypeData = @"@@LineOfBusiness
SystemName,DisplayName
1,LoB_one
2,LoB_two

@@BusinessUnit
SystemName,DisplayName
BU1,BU_one
2,BU_two";

var importRequest = new ImportRequest(multiTypeData);
var response = await client.AwaitResponse(
    importRequest,
    o => o.WithTarget(new ImportAddress(2024))
);

Distributed Import Processing

Example of a complex distributed import scenario that processes transactional data and computes derived values:

// Define distributed import data
var distributedData = @"@@TransactionalData
Id,Year,LoB,BusinessUnit,Value
1,2024,1,1,1.5
2,2024,1,2,2
3,2024,2,1,3
4,2024,2,2,4";

// Configure import with format
var importRequest = new ImportRequest(distributedData) {
    Format = "CashflowImport"  // Specify import format
};

// Send to import hub
var importResponse = await client.AwaitResponse(
    importRequest,
    o => o.WithTarget(new ImportAddress(2024))
);

// Data is automatically distributed and processed:
// 1. Transactional data is stored in TransactionalDataHub
// 2. Computed values are generated in ComputedDataHub

Configuration

Message Hub Setup

Configure routing for distributed processing:

configuration.WithRoutes(forward =>
    forward
        .RouteAddressToHostedHub<ReferenceDataAddress>(c => 
            c.ConfigureReferenceDataModel())
        .RouteAddressToHostedHub<TransactionalDataAddress>(c => 
            c.ConfigureTransactionalModel((TransactionalDataAddress)c.Address))
        .RouteAddressToHostedHub<ComputedDataAddress>(c => 
            c.ConfigureComputedModel((ComputedDataAddress)c.Address))
        .RouteAddressToHostedHub<ImportAddress>(c => 
            c.ConfigureImportHub((ImportAddress)c.Address))
);

Features

  1. Data Type Support

    • Reference data (e.g., LineOfBusiness, BusinessUnit)
    • Transactional data
    • Computed data
    • Custom data types
  2. Import Formats

    • CSV with type headers (@@TypeName)
    • Multiple types in single import
    • Custom format handlers
  3. Distributed Processing

    • Message-based routing
    • Parallel processing
    • Computed value generation
    • Data aggregation
  4. Activity Tracking

    • Import status monitoring
    • Error handling
    • Activity logging
    • Progress tracking

Best Practices

  1. Data Organization

    @@DataType1
    field1,field2
    value1,value2
    
    @@DataType2
    field1,field2
    value1,value2
    
  2. Error Handling

    try
    {
        var response = await client.AwaitResponse(importRequest, options);
        if (response.Message.Log.Status != ActivityStatus.Succeeded)
        {
            // Handle import failure
        }
    }
    catch (Exception ex)
    {
        // Handle errors
    }
    
  3. Data Validation

    • Validate data before import
    • Check for required fields
    • Verify data relationships
    • Handle duplicates

Integration

With Message Hub

services.AddMessageHub(hub => hub
    .ConfigureServices(services => services
        .AddImport()
        .AddReferenceData()
        .AddTransactionalData()
        .AddComputedData()
    )
);
  • MeshWeaver.Data - Core data framework
  • MeshWeaver.Messaging.Hub - Message routing and processing
  • MeshWeaver.Activities - Activity tracking and logging
Product Compatible and additional computed target framework versions.
.NET net9.0 is compatible.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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.3.0 177 8/4/2025
2.2.0 488 7/21/2025
2.1.0 175 4/6/2025
2.0.3 481 3/24/2025
2.0.2 473 3/24/2025
2.0.1 124 3/21/2025
2.0.0 157 3/20/2025
2.0.0-preview3 103 2/28/2025
2.0.0-Preview2 99 2/10/2025
2.0.0-preview1 97 1/6/2025
1.0.1 132 10/8/2024
1.0.0 121 10/8/2024