MeshWeaver.Import 2.0.3

There is a newer version of this package available.
See the version list below for details.
dotnet add package MeshWeaver.Import --version 2.0.3
                    
NuGet\Install-Package MeshWeaver.Import -Version 2.0.3
                    
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.0.3" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="MeshWeaver.Import" Version="2.0.3" />
                    
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.0.3
                    
#r "nuget: MeshWeaver.Import, 2.0.3"
                    
#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.
#addin nuget:?package=MeshWeaver.Import&version=2.0.3
                    
Install MeshWeaver.Import as a Cake Addin
#tool nuget:?package=MeshWeaver.Import&version=2.0.3
                    
Install MeshWeaver.Import 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. 
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.1.0 66 5 days ago
2.0.3 450 18 days ago
2.0.2 442 18 days ago
2.0.1 97 21 days ago
2.0.0 135 22 days ago
2.0.0-preview3 82 a month ago
2.0.0-Preview2 81 2 months ago
2.0.0-preview1 79 3 months ago
1.0.1 109 6 months ago
1.0.0 102 6 months ago