Joselct.Communication.Contracts 1.0.4

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

Joselct.Communication.Contracts

Core contracts for the Joselct.Communication library.

Reference this package when you need to share integration message types across multiple projects without pulling in the full RabbitMQ implementation.

Installation

dotnet add package Joselct.Communication.Contracts

What's Included

IntegrationMessage

Base record for all messages exchanged between microservices:

public abstract record IntegrationMessage
{
    public Guid Id { get; init; }
    public DateTimeOffset CreatedAt { get; init; }
    public string? CorrelationId { get; init; }
    public string? Source { get; init; }
}

Define your integration events by inheriting from it:

public record OrderCreatedIntegrationEvent(
    Guid OrderId,
    string CustomerEmail,
    decimal Total
) : IntegrationMessage;

IExternalPublisher

Publishes messages to the broker:

public interface IExternalPublisher
{
    Task PublishAsync<T>(
        T message,
        string? destination = null,
        bool declareDestination = false,
        CancellationToken ct = default
    ) where T : IntegrationMessage;
}

IIntegrationMessageConsumer<T>

Handles received messages:

public interface IIntegrationMessageConsumer<T> where T : IntegrationMessage
{
    Task HandleAsync(T message, CancellationToken ct = default);
}

Usage

Defining integration events

// Shared between microservices — only needs Contracts package
public record OrderCreatedIntegrationEvent(
    Guid OrderId,
    string CustomerEmail
) : IntegrationMessage;

Implementing a consumer

public class OrderCreatedConsumer : IIntegrationMessageConsumer<OrderCreatedIntegrationEvent>
{
    public async Task HandleAsync(OrderCreatedIntegrationEvent message, CancellationToken ct)
    {
        // process the event
    }
}

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.
  • net8.0

    • No dependencies.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on Joselct.Communication.Contracts:

Package Downloads
Joselct.Communication.RabbitMQ

RabbitMQ implementation for Joselct.Communication with OpenTelemetry support and persistent connections.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.4 310 3/6/2026
1.0.3 113 3/6/2026
1.0.2 138 3/6/2026
1.0.1 237 3/1/2026
1.0.0 144 2/28/2026