CrossQueue.Hub
1.1.8
dotnet add package CrossQueue.Hub --version 1.1.8
NuGet\Install-Package CrossQueue.Hub -Version 1.1.8
<PackageReference Include="CrossQueue.Hub" Version="1.1.8" />
<PackageVersion Include="CrossQueue.Hub" Version="1.1.8" />
<PackageReference Include="CrossQueue.Hub" />
paket add CrossQueue.Hub --version 1.1.8
#r "nuget: CrossQueue.Hub, 1.1.8"
#:package CrossQueue.Hub@1.1.8
#addin nuget:?package=CrossQueue.Hub&version=1.1.8
#tool nuget:?package=CrossQueue.Hub&version=1.1.8
CrossQueue.Hub
CrossQueue.Hub
CrossQueue.Hub is a lightweight .NET library that provides a unified abstraction for working with multiple message brokers such as RabbitMQ, Apache Kafka, and AWS SQS.
It allows you to publish and subscribe to messages in a transport-agnostic way, keeping your application code clean and scalable.
🚀 Features
- Unified interface for RabbitMQ, Kafka, and AWS SQS.
- JSON message serialization/deserialization built-in.
- Publisher/Subscriber abstraction for simplicity.
- Easily extendable to other message brokers.
- Configurable and production-ready.
📦 Installation
dotnet add package CrossQueue.Hub
⚡ Usage
1. Configure the broker in your appsettings.json
{
"CrossQueueHub": {
"RabbitMQ": {
"ConnectionString": "amqp://guest:guest@localhost:5672/",
"DefaultExchange": "default-exchange",
"DefaultExchangeType": "fanout",
"Durable": true,
"PublishRetryCount": 5,
"PublishRetryDelayMs": 200,
"ConsumerRetryCount": 5,
"ConsumerRetryDelayMs": 500,
"DeadLetterExchange": "dlx"
}
}
}
2. Register CrossQueue.Hub in Program.cs
The are two overloads of the AddCrossQueueHubRabbitMqBus()
method
// Using Action<CrossQueueOptions> overload for code-based config
builder.Services.AddCrossQueueHubRabbitMqBus(opt =>
{
opt.ConnectionString = "amqp://guest:guest@localhost:5672/";
opt.DefaultExchange = "myapp.exchange";
opt.DefaultExchangeType = ExchangeType.Topic;
});
// Using IConfiguration overload
builder.Services.AddCrossQueueHubRabbitMqBus(builder.Configuration);
// OR using custom section name.
// In this case, your section in the appsettings.json will be 'MyCustomRabbitMq' instead of 'CrossQueueHub'
builder.Services.AddRabbitMqBus(builder.Configuration, "MyCustomRabbitMq");
3. Inject the RabbitMQPubSub class into the constructor of the class you want to use it.
public class RabbitMQPubSubTest
{
private readonly IRabbitMQPubSub _pubSub;
public RabbitMQPubSubUser(IRabbitMQPubSub pubSub)
{
_pubSub = pubSub;
}
}
4. Publish a message
await _pubSub.PublishAsync(new { Text = "Hello World" }, routingKey: "my.route");
5. Subscribe to a message
_pubSub.Subscribe<dynamic>("my.queue", async msg =>
{
Console.WriteLine($"Received: {msg.Text}");
await Task.CompletedTask;
}, routingKey: "my.route");
🛠 Supported Brokers
- ✅ RabbitMQ
📖 Roadmap
- Apache Kafka
- AWS SQS
- Add support for Azure Service Bus.
- Metrics & observability integrations.
🤝 Contributing
Pull requests are welcome! For major changes, please open an issue first to discuss what you’d like to change.
📜 License
MIT License
Product | Versions 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. |
-
net8.0
- Microsoft.Extensions.Configuration.Abstractions (>= 8.0.0)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 8.0.2)
- Microsoft.Extensions.Logging.Abstractions (>= 8.0.3)
- Microsoft.Extensions.Options.ConfigurationExtensions (>= 8.0.0)
- Polly (>= 8.6.2)
- RabbitMQ.Client (>= 6.8.1)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.