ND.FW.QueueManagement 1.0.0

dotnet add package ND.FW.QueueManagement --version 1.0.0
                    
NuGet\Install-Package ND.FW.QueueManagement -Version 1.0.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="ND.FW.QueueManagement" Version="1.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="ND.FW.QueueManagement" Version="1.0.0" />
                    
Directory.Packages.props
<PackageReference Include="ND.FW.QueueManagement" />
                    
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 ND.FW.QueueManagement --version 1.0.0
                    
#r "nuget: ND.FW.QueueManagement, 1.0.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 ND.FW.QueueManagement@1.0.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=ND.FW.QueueManagement&version=1.0.0
                    
Install as a Cake Addin
#tool nuget:?package=ND.FW.QueueManagement&version=1.0.0
                    
Install as a Cake Tool

ND.FW.QueueManagement

Provider-agnostic message publish/consume abstraction for Novacis Digital services.

Business code depends only on IQueuePublisher, IQueueConsumer, and IQueueProviderFactory — never on ActiveMQ or Azure Service Bus types directly. The active provider is selected via configuration (Messaging:Provider), so switching providers is a config change, not a code change.

Supported providers:

  • ActiveMQ (via MassTransit) — primary
  • Azure Service Bus — supported, credential-resolved through ND.FW.ClientManagement

Install

dotnet add package ND.FW.QueueManagement

Depends on ND.FW.ClientManagement (for Service Bus credential resolution). NuGet restores it transitively.

Register

using QueueManagement.Extensions;

// Registers both provider implementations + IQueueProviderFactory,
// bound from configuration sections "ActiveMQ" and "ServiceBus"
services.AddQueueConsumer(configuration);

// Starts the background worker that drives message consumption
services.AddQueueConsumerWorker();

Or register a single provider explicitly if you don't need the factory:

services.AddActiveMQ(options =>
{
    options.BrokerUri = "activemq:tcp://broker:61616";
    options.QueueName = "intake-events";
});

// — or —

services.AddAzureServiceBus(options =>
{
    options.FullyQualifiedNamespace = "mynamespace.servicebus.windows.net";
    options.QueueName = "intake-events";
    options.CredentialType = CredentialType.ManagedIdentity; // from ND.FW.ClientManagement
});

Publishing

public class MyPublisher
{
    private readonly IQueuePublisher _publisher;

    public MyPublisher(IQueueProviderFactory factory)
    {
        _publisher = factory.GetPublisher("servicebus"); // or "activemq"
    }

    public Task PublishAsync(MyEvent evt) =>
        _publisher.PublishAsync(evt, "intake-events");
}

PublishAsync<T> serialises T to JSON and injects trace correlation headers. PublishBatchAsync<T> is available for high-throughput scenarios.

Consuming

public class MyMessageHandler : IMessageHandler
{
    public async Task HandleAsync(QueueMessageContext context, CancellationToken ct)
    {
        // deserialize context.Body, do work...
        await context.CompleteAsync();      // ack — removes from queue
        // await context.AbandonAsync();    // negative-ack — redeliver
        // await context.DeadLetterAsync("reason"); // move to DLQ
    }
}

QueueConsumerWorker (registered via AddQueueConsumerWorker()) resolves all IMessageHandler registrations and invokes them in registration order for each incoming message. Register your handler as scoped:

services.AddScoped<IMessageHandler, MyMessageHandler>();

API

Interface Purpose
IQueuePublisher Publish single/batch messages to a named queue
IQueueConsumer Start/stop consuming; exposes QueueMessageContext lifecycle
IQueueProviderFactory Resolve the active IQueuePublisher / IQueueConsumer by provider name ("activemq" / "servicebus")
IMessageHandler Domain-level handler invoked per message by QueueConsumerWorker
IMessageProcessor Orchestrates full message processing (deserialize → handle → ack/abandon/dead-letter)

QueueMessageContext

public sealed record QueueMessageContext
{
    string MessageId;
    string Body;
    IReadOnlyDictionary<string, object> Properties;
    Func<Task> CompleteAsync;
    Func<Task> AbandonAsync;
    Func<string?, Task> DeadLetterAsync;
}

Configuration

{
  "ActiveMQ": {
    "BrokerUri": "tcp://broker:61616",
    "QueueName": "intake-events",
    "Username": "",
    "Password": ""
  },
  "ServiceBus": {
    "FullyQualifiedNamespace": "mynamespace.servicebus.windows.net",
    "QueueName": "intake-events",
    "MaxConcurrentCalls": 5,
    "CredentialType": "ManagedIdentity"
  }
}

Dependencies

  • MassTransit / MassTransit.ActiveMQ 8.2.3
  • Azure.Messaging.ServiceBus 7.18.0
  • ND.FW.ClientManagement (>= 1.0.0) — required for Service Bus credential resolution. Must be published before this package.

Publish order

ND.FW.ClientManagement  →  ND.FW.QueueManagement

License

MIT

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 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
1.0.0 229 7/7/2026