FluxFlow.Composition 1.2.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package FluxFlow.Composition --version 1.2.0
                    
NuGet\Install-Package FluxFlow.Composition -Version 1.2.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="FluxFlow.Composition" Version="1.2.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="FluxFlow.Composition" Version="1.2.0" />
                    
Directory.Packages.props
<PackageReference Include="FluxFlow.Composition" />
                    
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 FluxFlow.Composition --version 1.2.0
                    
#r "nuget: FluxFlow.Composition, 1.2.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 FluxFlow.Composition@1.2.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=FluxFlow.Composition&version=1.2.0
                    
Install as a Cake Addin
#tool nuget:?package=FluxFlow.Composition&version=1.2.0
                    
Install as a Cake Tool

FluxFlow.Composition

Optional standalone-first composition for FluxFlow.Nodes.

Use this package when a host wants to build a workflow from fluent C# or Microsoft.Extensions.Configuration JSON while keeping component packages free of FluxFlow.Engine.

Boundary

FluxFlow.Composition owns:

  • composition DTOs: workflows, nodes, links, and port references
  • explicit node type to factory registration
  • fluent C# definition building
  • IConfiguration loading
  • structural validation
  • direct typed Dataflow linking
  • runtime start, stop, completion, event/error aggregation, and disposal

It does not own broker clients, stores, secrets, resource registration, file watching, YAML, live reload, assembly scanning, reflection discovery, or engine projection.

Definition DTO collection properties copy assigned dictionaries and lists with ordinal key comparison. A host can still intentionally edit the model before validation/build, but caller-owned collections used during construction cannot mutate the definition later. Workflow, node, configuration, and resource dictionary keys are trimmed when assigned or built fluently; duplicate keys after trimming are rejected at the composition boundary. Node and port references trim assigned workflow/node/port segments and reject empty dotted segments when parsed from fluent or configuration link strings. Node definition types, node registration types, and composition port metadata names are trimmed at the public boundary so incidental configuration or registration whitespace does not create unknown node types or duplicate-looking ports. Composition port metadata rejects null or blank port names and null message types at the registration boundary. Node registrations also reject null port metadata entries before validation/build. CompositionPortMetadata also supports deconstruction for callers that prefer tuple-style reads. If mutable DTO collections are hand-built with null workflow, node, link, or link endpoint entries, validation reports InvalidDefinition diagnostics instead of throwing while walking the model.

ComposedNode disposal always attempts both the node disposal path and the optional descriptor cleanup hook. If both fail, the failures are reported together so cleanup diagnostics do not hide an adapter-owned resource leak. If a build is canceled after nodes or links have been allocated, the runtime builder disposes the partially built graph before rethrowing cancellation.

Fluent Composition

var registry = new CompositionNodeRegistry()
    .Register(
        "sample.source",
        context =>
        {
            var options = context.BindConfiguration<SourceOptions>();
            var node = new StringSourceNode(options.Messages);
            return ValueTask.FromResult(ComposedNode.Create(
                node,
                outputs: [CompositionPorts.Output<string>("Output", node.Output)],
                events: node.Events,
                errors: node.Errors));
        },
        outputs: [CompositionPorts.Metadata<string>("Output")]);

var definition = CompositionDefinitionBuilder
    .Create()
    .Workflow("main", workflow => workflow
        .Node("source", "sample.source", node => node.Configure("messages", new[] { "alpha" }))
        .Node("sink", "sample.sink")
        .Link("source.Output", "sink.Input"))
    .Build();

var result = await new CompositionRuntimeBuilder(registry).BuildAsync(definition, services);
if (!result.Succeeded)
{
    foreach (var diagnostic in result.Diagnostics)
        Console.Error.WriteLine(diagnostic.Message);
}

await using var runtime = result.Runtime!;
await runtime.StartAsync();
await runtime.Completion;

Configuration Shape

The default loader reads FluxFlow:Composition:

{
  "FluxFlow": {
    "Composition": {
      "workflows": {
        "main": {
          "nodes": {
            "source": {
              "type": "sample.source",
              "configuration": {
                "messages": [ "alpha", "beta" ]
              },
              "resources": {
                "store": "primary-store"
              }
            },
            "sink": {
              "type": "sample.sink"
            }
          },
          "links": [
            { "from": "source.Output", "to": "sink.Input" }
          ]
        }
      }
    }
  }
}
var definition = new CompositionConfigurationLoader().Load(configuration);

Resources are named references only. The host or adapter DI layer still owns the concrete resource registration and lifetime. Node factories resolve those references with the CompositionNodeFactoryContext instance methods GetRequiredResourceKey, GetRequiredResource<TResource>, and GetResource<TResource> over the keyed services the host registered.

Use FluxFlow.Composition.Hosting when DI should build and start the runtime with host lifecycle.

Sample

Run the pure in-memory sample:

dotnet run --project samples/FluxFlow.CompositionSample/FluxFlow.CompositionSample.csproj
Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  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.  net9.0 was computed.  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 is compatible.  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 (24)

Showing the top 5 NuGet packages that depend on FluxFlow.Composition:

Package Downloads
FluxFlow.Engine

Canonical FluxFlow application runtime assembler with transactional revisions, stable addressable ports, conditional routing, system events, and diagnostics.

FluxFlow.Components.Designer

Reusable component metadata and canonical application editing contracts for FluxFlow.

FluxFlow.Composition.Hosting

Optional hosting bridge for FluxFlow.Composition that builds standalone compositions from DI/configuration, starts them with host lifecycle, and resolves adapter-owned keyed resources.

FluxFlow.Fluent

Type-safe, code-first fluent DSL for composing FluxFlow standalone nodes into a runnable graph — Flow.From(source).Then(node).To(sink) with compile-time-checked wiring, branching, and fan-in. Reuses the FluxFlow.Composition runtime.

FluxFlow.Components.Mqtt.Composition

Canonical FluxFlow Composition resources and nodes for provider-neutral MQTT client control, publication, subscriptions, and client events.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
8.0.0-rc.1 300 9/5/2026
7.0.0-rc.1 438 8/9/2026
6.0.0 933 8/3/2026
1.2.0 228 7/3/2026
1.1.0 567 7/3/2026
1.0.9 645 7/2/2026

Adds CompositionRuntime.Create, a public code-first factory that builds a runtime from composed node descriptors and links without a definition or registry (used by the fluent DSL).