![]() |
VOOZH | about |
dotnet add package MeshWeaver.Messaging.Contract --version 2.5.0
NuGet\Install-Package MeshWeaver.Messaging.Contract -Version 2.5.0
<PackageReference Include="MeshWeaver.Messaging.Contract" Version="2.5.0" />
<PackageVersion Include="MeshWeaver.Messaging.Contract" Version="2.5.0" />Directory.Packages.props
<PackageReference Include="MeshWeaver.Messaging.Contract" />Project file
paket add MeshWeaver.Messaging.Contract --version 2.5.0
#r "nuget: MeshWeaver.Messaging.Contract, 2.5.0"
#:package MeshWeaver.Messaging.Contract@2.5.0
#addin nuget:?package=MeshWeaver.Messaging.Contract&version=2.5.0Install as a Cake Addin
#tool nuget:?package=MeshWeaver.Messaging.Contract&version=2.5.0Install as a Cake Tool
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.
// Unique identifiers for message hubs
public record Address(string Type, string Id);
public record HostAddress() : Address("host", "main");
// 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; }
}
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
);
}
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);
}
public class MessageHubConfiguration
{
// Register message types
public MessageHubConfiguration WithTypes(params Type[] types);
// Register message handler
public MessageHubConfiguration WithHandler<TRequest>(
Func<IMessageHub, TRequest, Task> handler
);
}
// Request message
record PingRequest : IRequest<PongResponse>;
// Response message
record PongResponse;
configuration.WithHandler<PingRequest>((hub, request) =>
{
// Handle the request
hub.Post(new PongResponse(), opt => opt.ResponseFor(request));
return request.Processed();
});
IRequest<TResponse> interfaceRefer 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. |
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 |
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 |