VOOZH about

URL: https://www.nuget.org/packages/MeshWeaver.Messaging.Contract/

⇱ NuGet Gallery | MeshWeaver.Messaging.Contract 2.5.0




MeshWeaver.Messaging.Contract 2.5.0

There is a newer prerelease version of this package available.
See the version list below for details.
dotnet add package MeshWeaver.Messaging.Contract --version 2.5.0
 
 
NuGet\Install-Package MeshWeaver.Messaging.Contract -Version 2.5.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="MeshWeaver.Messaging.Contract" Version="2.5.0" />
 
 
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="MeshWeaver.Messaging.Contract" Version="2.5.0" />
 
Directory.Packages.props
<PackageReference Include="MeshWeaver.Messaging.Contract" />
 
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.Messaging.Contract --version 2.5.0
 
 
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: MeshWeaver.Messaging.Contract, 2.5.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 MeshWeaver.Messaging.Contract@2.5.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=MeshWeaver.Messaging.Contract&version=2.5.0
 
Install as a Cake Addin
#tool nuget:?package=MeshWeaver.Messaging.Contract&version=2.5.0
 
Install as a Cake Tool
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

MeshWeaver.Messaging.Contract

Overview

MeshWeaver.Messaging.Contract defines the core interfaces, types, and abstractions that power the MeshWeaver messaging system. This library provides the contract definitions that enable type-safe message passing between hubs and standardized message handling patterns.

Core Concepts

Addresses

// Unique identifiers for message hubs
public record Address(string Type, string Id);
public record HostAddress() : Address("host", "main");

Message Contracts

Request-Response Pattern
// Base interface for request messages
public interface IRequest<TResponse>
{
 // Marker interface for requests expecting TResponse
}

// Message delivery interface
public interface IMessageDelivery<TMessage>
{
 TMessage Message { get; }
}

Message Hub Interface

public interface IMessageHub
{
 // Send a message and await response
 Task<IMessageDelivery<TResponse>> AwaitResponse<TResponse>(
 IRequest<TResponse> request,
 Action<MessageOptions> configureOptions,
 CancellationToken cancellationToken = default
 );

 // Post a message without waiting for response
 void Post<TMessage>(
 TMessage message,
 Action<MessageOptions> configureOptions
 );
}

Message Options

public class MessageOptions
{
 // Configure message as response to a request
 public void ResponseFor<T>(T request);
 
 // Set target hub address
 public void WithTarget(Address address);
}

Configuration

Hub Configuration

public class MessageHubConfiguration
{
 // Register message types
 public MessageHubConfiguration WithTypes(params Type[] types);
 
 // Register message handler
 public MessageHubConfiguration WithHandler<TRequest>(
 Func<IMessageHub, TRequest, Task> handler
 );
}

Usage Patterns

Defining Messages

// Request message
record PingRequest : IRequest<PongResponse>;

// Response message
record PongResponse;

Message Handler Registration

configuration.WithHandler<PingRequest>((hub, request) =>
{
 // Handle the request
 hub.Post(new PongResponse(), opt => opt.ResponseFor(request));
 return request.Processed();
});

Best Practices

  1. Always define request-response pairs using the IRequest<TResponse> interface
  2. Use strongly-typed messages for type safety
  3. Keep message contracts simple and serializable
  4. Use meaningful addresses for hub identification
  5. Configure message timeouts for reliability
  6. Handle message failures gracefully

Integration

  • Used by for message processing
  • Provides contract definitions for all MeshWeaver messaging components
  • Enables custom message hub implementations

See Also

Refer to the for more information about the overall messaging architecture.

Product Versions Compatible and additional computed target framework versions.
.NET net9.0 net9.0 is compatible.  net9.0-android net9.0-android was computed.  net9.0-browser net9.0-browser was computed.  net9.0-ios net9.0-ios was computed.  net9.0-maccatalyst net9.0-maccatalyst was computed.  net9.0-macos net9.0-macos was computed.  net9.0-tvos net9.0-tvos was computed.  net9.0-windows net9.0-windows was computed.  net10.0 net10.0 was computed.  net10.0-android net10.0-android was computed.  net10.0-browser net10.0-browser was computed.  net10.0-ios net10.0-ios was computed.  net10.0-maccatalyst net10.0-maccatalyst was computed.  net10.0-macos net10.0-macos was computed.  net10.0-tvos net10.0-tvos was computed.  net10.0-windows 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 (4)

Showing the top 4 NuGet packages that depend on MeshWeaver.Messaging.Contract:

Package Downloads
MeshWeaver.Messaging.Hub

Package Description

MeshWeaver.Data.Contract

Package Description

MeshWeaver.Mesh.Contract

Package Description

MeshWeaver.Markdown.Collaboration

Package Description

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
3.0.0-preview1 288 4/16/2026
2.5.0 599 11/3/2025
2.4.0 575 10/2/2025
2.3.0 560 8/4/2025
2.2.0 850 7/21/2025
2.1.0 490 4/6/2025
2.0.3 819 3/24/2025
2.0.2 803 3/24/2025
2.0.1 443 3/21/2025
2.0.0 482 3/20/2025
2.0.0-preview3 420 2/28/2025
2.0.0-Preview2 467 2/10/2025
2.0.0-preview1 461 1/6/2025
1.0.1 476 10/8/2024
1.0.0 467 10/8/2024