mercurio
A library to make RabbitMQ integration in .NET microservices seamless
Science Score: 44.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
✓CITATION.cff file
Found CITATION.cff file -
✓codemeta.json file
Found codemeta.json file -
✓.zenodo.json file
Found .zenodo.json file -
○DOI references
-
○Academic publication links
-
○Academic email domains
-
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (9.1%) to scientific vocabulary
Repository
A library to make RabbitMQ integration in .NET microservices seamless
Basic Info
- Host: GitHub
- Owner: STARIONGROUP
- License: apache-2.0
- Language: C#
- Default Branch: development
- Size: 252 KB
Statistics
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
- Releases: 12
Metadata Files
README.md

Mercurio
A library to make RabbitMQ integration in .NET microservices seamless
Introduction
Mercurio provides RabbitMQ integration with common implementation of Messaging Client. This common implementation of messaging client reduce the need of code duplication on microservices implementation that requires to interacts with RabbitMQ.
It also eases the setup of ConnectionFactory and also to register multiple ConnectionFactory setup, using the IRabbitMqConnectionProvider.
Mercurio follows RabbitMQ best practices by encouraging connection reuse and channel pooling per named connection. Instead of creating new connections for every operation—which is inefficient and discouraged by RabbitMQ—it provides a shared, thread-safe mechanism to lease and reuse channels from a limited pool tied to a single registered connection. This improves performance, resource management, and aligns with RabbitMQ's recommendations for production-grade messaging systems.
See channel reuse and connection management for more details on the implementation.
Examples
Dependency Injection Registration
```csharp var serviceCollection = new ServiceCollection();
serviceCollection.AddRabbitMqConnectionProvider() .WithRabbitMqConnectionFactoryAsync("Primary", _ => { var connectionFactory = new ConnectionFactory() { HostName = "localhost", Port = 5432 };
return Task.FromResult(connectionFactory);
})
.WithRabbitMqConnectionFactory("Secondary", _ =>
{
var connectionFactory = new ConnectionFactory()
{
HostName = "localhost",
Port = 5433
};
return connectionFactory;
})
.WithSerialization();
var serviceProvider = serviceCollection.BuildServiceProvider();
var connectionProvider = serviceProvider.GetRequiredService
📦 Message Serialization
Mercurio uses a flexible and extensible serialization system that supports multiple formats and allows format-specific resolution at runtime.
By default, Mercurio registers System.Text.Json-based serializers and deserializers. However, you can register custom implementations or support additional formats like MessagePack.
Serialization is configured using .WithSerialization() in your service registration:
csharp
services
.AddRabbitMqConnectionProvider()
.WithSerialization(builder => builder
.UseDefaultJson() // Registers JsonMessageSerializerService that uses System.Text.Json as default serializer
.UseMessagePack<YourMessagePackSerializer>(asDefault: false)); // Optional additional format
Under the hood, serialization is format-aware:
- Each format (e.g.,
Json,MessagePack) is keyed bySupportedSerializationFormatand is transported in the 'content type' header. - A central
SerializationProviderServicehandles resolution of serializers and deserializers. - The default format (usually
Json) is mapped to the special keyUnspecified.
The following interfaces drive the system:
IMessageSerializerService– used to serialize outgoing messages.IMessageDeserializerService– used to deserialize incoming messages.ISerializationProviderService– allows resolving serializers and deserializers for a given format.
All registered services are added via IServiceCollection using Microsoft.Extensions.DependencyInjection’s keyed services.
🔧 Default Behavior
If .WithSerialization() is called without configuration, Mercurio will:
- Register
JsonMessageSerializerServicefor both serializer and deserializer interfaces. - Use
SupportedSerializationFormat.Jsonas the default. - Register a fallback mapping under
SupportedSerializationFormat.Unspecified.
🔄 Format Resolution
Serialization and deserialization for a given format can be resolved at runtime via:
csharp
var serializer = serializationProvider.ResolveSerializer(SupportedSerializationFormat.Json);
var deserializer = serializationProvider.ResolveDeserializer(SupportedSerializationFormat.MessagePack);
MessageClientService
A base implementation of a MessageClientService is available. It defines base behavior to push and listen after messages on queue and exchange.
Following example expects to have a connection registered, the service registered as IMessageClientBaseService into the service collection and will use Direct Exchange.
Push Message
csharp
var messageClientService = serviceProvider.GetRequiredService<IMessageClientBaseService>();
var exchangeConfiguration = new DirectExchangeConfiguration("DirectQueue", "AnExchange", "SomeRouting");
await messageClientService.PushAsync("RegisteredConnection","A message to be sent",exchangeConfiguration);
Listen After Message
csharp
var messageClientService = serviceProvider.GetRequiredService<IMessageClientBaseService>();
var exchangeConfiguration = new DirectExchangeConfiguration("DirectQueue", "AnExchange", "SomeRouting");
var messageObservable = await messageClientService.ListenAsync<string>("RegisteredConnection", exchangeConfiguration);
messageObservable.Subscribe(message => Console.WriteLine(message));
Integration Tests
Before running any integration tests, it is required to have a running instance of RabbitMQ.
Please use this following command to run it :
sh
docker run -d --name mercurio -p 15672:15672 -p 5672:5672 rabbitmq:4-management
Code Quality
Nuget
The Mercurio library is released as NuGet package and available from nuget.org.
Software Bill of Materials (SBOM)
As part of our commitment to security and transparency, this project includes a Software Bill of Materials (SBOM) in the associated NuGet packages. The SBOM provides a detailed inventory of the components and dependencies included in the package, allowing you to track and verify the software components, their licenses, and versions.
Why SBOM?
- Improved Transparency: Gain insight into the open-source and third-party components included in this package.
- Security Assurance: By providing an SBOM, we enable users to more easily track vulnerabilities associated with the included components.
- Compliance: SBOMs help ensure compliance with licensing requirements and make it easier to audit the project's dependencies.
You can find the SBOM in the NuGet package itself, which is automatically generated and embedded during the build process.
Owner
- Name: Starion Group
- Login: STARIONGROUP
- Kind: organization
- Email: info@stariongroup.eu
- Location: Europe and Canada
- Website: https://www.stariongroup.eu
- Twitter: stariongroupeu
- Repositories: 1
- Profile: https://github.com/STARIONGROUP
Highly specialised system engineering expertise, services and solutions for space, defence and other critical infrastructures
Citation (CITATION.cff)
cff-version: 1.2.0
message: "If you use this software, please cite it as below."
title: "Mercurio"
abstract: "A library to make RabbitMQ integration in .NET microservices seamless"
version: "1.8.1"
date-released: "2025-09-02"
url: "https://github.com/STARIONGROUP/Mercurio"
authors:
- given-names: "Antoine"
family-names: "Théate"
orcid: "https://orcid.org/0009-0006-6964-7066"
affiliation: "Starion Group S.A."
- given-names: "Nathanael"
family-names: "Smiechowski"
orcid: "https://orcid.org/0009-0007-1346-1577"
affiliation: "Starion Group S.A."
- given-names: "Sam"
family-names: "Gerené"
affiliation: "Starion Group S.A."
orcid: "https://orcid.org/0009-0000-1848-550X"
- name: "Starion Group S.A."
affiliation: "Starion Group S.A."
given-names: "MBSE Competence Area Developers"
repository-code: "https://github.com/STARIONGROUP/Mercurio"
license: "Apache-2.0"
preferred-citation:
type: software
title: "A library to make RabbitMQ integration in .NET microservices seamless"
authors:
- given-names: "Antoine"
family-names: "Théate"
orcid: "https://orcid.org/0009-0006-6964-7066"
affiliation: "Starion Group S.A."
- given-names: "Nathanael"
family-names: "Smiechowski"
orcid: "https://orcid.org/0009-0007-1346-1577"
affiliation: "Starion Group S.A."
- given-names: "Sam"
family-names: "Gerené"
affiliation: "Starion Group S.A."
orcid: "https://orcid.org/0009-0000-1848-550X"
- name: "Starion Group S.A."
affiliation: "Starion Group S.A."
given-names: "MBSE Competence Area Developers"
version: "1.8.1"
url: "https://github.com/STARIONGROUP/Mercurio"
date-released: "2025-09-02"
GitHub Events
Total
- Create event: 20
- Issues event: 6
- Release event: 6
- Watch event: 2
- Delete event: 12
- Issue comment event: 33
- Push event: 56
- Gollum event: 13
- Pull request review comment event: 4
- Pull request review event: 13
- Pull request event: 23
Last Year
- Create event: 20
- Issues event: 6
- Release event: 6
- Watch event: 2
- Delete event: 12
- Issue comment event: 33
- Push event: 56
- Gollum event: 13
- Pull request review comment event: 4
- Pull request review event: 13
- Pull request event: 23
Issues and Pull Requests
Last synced: 6 months ago
All Time
- Total issues: 4
- Total pull requests: 15
- Average time to close issues: 3 days
- Average time to close pull requests: about 12 hours
- Total issue authors: 3
- Total pull request authors: 2
- Average comments per issue: 0.0
- Average comments per pull request: 0.67
- Merged pull requests: 11
- Bot issues: 0
- Bot pull requests: 0
Past Year
- Issues: 4
- Pull requests: 15
- Average time to close issues: 3 days
- Average time to close pull requests: about 12 hours
- Issue authors: 3
- Pull request authors: 2
- Average comments per issue: 0.0
- Average comments per pull request: 0.67
- Merged pull requests: 11
- Bot issues: 0
- Bot pull requests: 0
Top Authors
Issue Authors
- antoineatstariongroup (2)
- nathanatstariongroup (1)
- samatstariongroup (1)
Pull Request Authors
- antoineatstariongroup (9)
- samatstariongroup (5)
Top Labels
Issue Labels
Pull Request Labels
Packages
- Total packages: 2
-
Total downloads:
- nuget 2,898 total
-
Total dependent packages: 0
(may contain duplicates) -
Total dependent repositories: 0
(may contain duplicates) - Total versions: 19
- Total maintainers: 3
nuget.org: mercurio.hosting
A Mercurio extension for microservice's hosting
- Homepage: https://github.com/STARIONGROUP/Mercurio
- License: Apache-2.0
-
Latest release: 1.4.0
published 6 months ago
Rankings
Maintainers (3)
nuget.org: mercurio
A library to make RabbitMQ integration in .NET microservices seamless
- Homepage: https://github.com/STARIONGROUP/Mercurio
- License: Apache-2.0
-
Latest release: 1.8.0
published 6 months ago
Rankings
Maintainers (3)
Dependencies
- actions/checkout v4 composite
- actions/setup-dotnet v4 composite
- actions/setup-java v4 composite
- actions/checkout v4 composite
- actions/setup-dotnet v4 composite
- github/codeql-action/analyze v3 composite
- github/codeql-action/init v3 composite
- actions/checkout v4 composite
- actions/setup-dotnet v4 composite
- Microsoft.AspNetCore.Hosting.Abstractions 2.3.0
- Microsoft.Extensions.DependencyInjection.Abstractions 9.0.5
- Polly 8.5.2
- RabbitMQ.Client 7.1.2
- NUnit.Analyzers 4.4.0 development
- coverlet.collector 6.0.2 development
- Microsoft.Extensions.Configuration 9.0.5
- Microsoft.Extensions.DependencyInjection 9.0.5
- Microsoft.Extensions.Options.DataAnnotations 9.0.5
- Microsoft.NET.Test.Sdk 17.12.0
- Moq 4.20.72
- NUnit 4.2.2
- NUnit3TestAdapter 4.6.0