Femur.Messaging.InMemory 0.0.31

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

Femur.Messaging.InMemory

In-memory transport implementation for Femur.Messaging. Perfect for testing and development.

Installation

dotnet add package Femur.Messaging.InMemory

Usage

Registration

var builder = Host.CreateApplicationBuilder(args);

// Register your message handler
builder.Services.AddSingleton<IMessageHandler<OrderMessage>, OrderMessageHandler>();

// Add in-memory transport
builder.Services.AddInMemoryTransport();

// Add message processor
builder.Services.AddMessageProcessor<OrderMessage>(options =>
{
    options.MaxConcurrentMessages = 5;
});

var host = builder.Build();
await host.RunAsync();

Sending Messages (for testing)

// Get the transport
var transport = serviceProvider.GetRequiredService<IMessagingTransport>();

// If it's the in-memory transport, you can enqueue messages
if (transport is InMemoryTransport inMemoryTransport)
{
    var message = new OrderMessage 
    { 
        OrderId = "123", 
        Amount = 99.99m 
    };
    
    inMemoryTransport.Enqueue(message);
}

Features

  • Thread-safe in-memory message queue
  • Message settlement (complete/abandon/dead-letter)
  • Perfect for unit tests and integration tests
  • No external dependencies

Testing Example

[Fact]
public async Task Handler_ProcessesMessage()
{
    // Arrange
    var services = new ServiceCollection();
    services.AddSingleton<IMessageHandler<OrderMessage>, OrderMessageHandler>();
    services.AddInMemoryTransport();
    services.AddMessageProcessor<OrderMessage>();
    
    var provider = services.BuildServiceProvider();
    var transport = provider.GetRequiredService<InMemoryTransport>();
    
    // Act
    transport.Enqueue(new OrderMessage { OrderId = "123", Amount = 99.99m });
    
    // Start processing
    var hostedService = provider.GetRequiredService<IHostedService>();
    await hostedService.StartAsync(CancellationToken.None);
    
    // Wait for processing
    await Task.Delay(100);
    
    // Assert
    Assert.Empty(transport.GetQueue<OrderMessage>());
}

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 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 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

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
0.0.31 132 3/30/2026