Atya.Messaging.InMemory 1.0.0

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

Atya.Messaging.InMemory

In-memory messaging transport for tests, local development, and contract validation in Atya services.

NuGet Version Downloads .NET 10.0 License: MIT

Overview

Atya.Messaging.InMemory is a small in-process transport that implements the Atya.Messaging.Abstractions publisher and consumer registry contracts. It is intended for tests, local development, samples, and contract validation before a durable or broker-backed transport is introduced.

The bus stores accepted envelopes in memory and delivers them to subscribed consumers in registration order.

Features

  • InMemoryMessageBus<TMessage> implements publishing and consumer registration.
  • DelegateMessageConsumer<TMessage> adapts a delegate to the consumer contract.
  • Published envelopes are retained for assertions.
  • Subscriptions can be removed through IMessageSubscription.
  • No broker, hosting, serializer, or dependency injection dependency.

Installation

dotnet add package Atya.Messaging.InMemory
Install-Package Atya.Messaging.InMemory
<PackageReference Include="Atya.Messaging.InMemory" Version="<latest-stable>" />

Quick Start

using Atya.Messaging.Abstractions;
using Atya.Messaging.InMemory;

var bus = new InMemoryMessageBus<string>();

await bus.SubscribeAsync(
    new DelegateMessageConsumer<string>((envelope, _) =>
    {
        Console.WriteLine(envelope.Message);
        return ValueTask.CompletedTask;
    }));

await bus.PublishAsync(
    "customer.created",
    new MessagePublishOptions(messageId: "message-1", correlationId: "correlation-1"));

Feature Tour

Assert published messages in a test:

using Atya.Messaging.InMemory;

var bus = new InMemoryMessageBus<string>();

await bus.PublishAsync("customer.created");

Console.WriteLine(bus.PublishedMessages[0].Message);

Remove a consumer:

using Atya.Messaging.InMemory;

var bus = new InMemoryMessageBus<string>();
var subscription = await bus.SubscribeAsync(
    new DelegateMessageConsumer<string>((_, _) => ValueTask.CompletedTask));

await subscription.UnsubscribeAsync();

Error Codes

This package does not define Result error codes. Invalid programmer input is rejected with standard .NET argument exceptions through Atya.Foundation.Guards.

Why These Dependencies

  • Atya.Messaging.Abstractions provides the publisher, consumer, subscription, and envelope contracts.
  • Atya.Foundation.Guards provides consistent argument validation for public entry points.
Product Compatible and additional computed target framework versions.
.NET 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
1.0.0 152 7/12/2026