NaiveMq.Client
1.0.0
dotnet add package NaiveMq.Client --version 1.0.0
NuGet\Install-Package NaiveMq.Client -Version 1.0.0
<PackageReference Include="NaiveMq.Client" Version="1.0.0" />
paket add NaiveMq.Client --version 1.0.0
#r "nuget: NaiveMq.Client, 1.0.0"
// Install NaiveMq.Client as a Cake Addin
#addin nuget:?package=NaiveMq.Client&version=1.0.0
// Install NaiveMq.Client as a Cake Tool
#tool nuget:?package=NaiveMq.Client&version=1.0.0
NaiveMq
.NET Standard message queue server and client.
Implemented so far:
- All async client interface.
- Simple custom client-server messaging protocol.
- User management.
- Queue management, publish message, queue subscriptions and message consuming.
- Message publish/consume confirmation.
- Exchanges, routing with regex.
- Request-response messages with response from consumer passed to producer.
- Durable queues.
- Disk only messages for long queues with big message data.
- Queue limits by length or volume with server behaviour delay, reject or discard the message.
- Server memory limits manual/automatic.
- Management console applicaton.
- Message or any type of request batching.
- Clustering.
Plans:
- Release.
- Better clustering.
- Better durable queues.
- Management UI.
- Unit tests.
- Integration tests.
Performance vs RabbitMQ (3.10.12)
Configuration: server and client on the same pc, Intel Core i5-7200U, DDR3 Dual 16Gb, SSD.
Scenario: 10 queues, 1 consumer, 1 producer per queue.
100 bytes | 10.000 bytes | 1.000.000 bytes | ||||
---|---|---|---|---|---|---|
NaiveMq | RabbitMq | NaiveMq | RabbitMq | NaiveMq | RabbitMq | |
Producers+Consumers | ||||||
In memory message without confirmation | 55.000 | 36.000* | ||||
In memory message with confirmation | 10.300 | 10.500 | 9.200 | 10.000 | 730 | 580 |
- 100 queues | 9.400 | 13.000 | ||||
- batch by 100 messages in one request | 16.000 | - | - | - | ||
- Rabbit-like batch by 100 messages | 15.000 | 44.000 | 12.600 | 19.000 | 650 | 450 |
In memory request-response message | 9.400 | - | - | - | ||
Persistent message without confirmation | 2.900 | 20.000** | ||||
Persistent message with confirmation | 2.500 | 600 | 2.100 | 400 | 490 | 100 |
- 100 queues | 2.500 | 700 | ||||
Disk only message with confirmation | 2.300 | - | 1.800 | - | 450 | - |
Producers | ||||||
In memory message without confirmation | 118.000 | 45.000* | ||||
In memory message with confirmation | 19.000 | 16.000 | ||||
- Rabbit-like batch by 100 messages | 96.000 | 52.000 | ||||
Persistent message without confirmation | 4.100 | 22.000** | ||||
Persistent message with confirmation | 2.500 | 600 | ||||
- Rabbit-like batch by 100 messages | 2.500 | 13.000 | - | - |
* RabbitMq .NET Client eats up all memory, so the test is stable for about a minute. Then numbers are jumping around 5.000-10.000.
** Same as * and disk I/O is low, not sure the messages are persistent after all.
Scalability
Since in the cluster mode the node has its own messages then teoretically the queue performance should scale linearly by multiplying one node performance by number of nodes, provided the producers and consumers are spread evenly beetween the nodes or redirect option is selected in consumer subscription as cluster subscription strategy.
Client Example
var client = new NaiveMqClient(new NaiveMqClientOptions());
await client.SendAsync(new AddQueue("test", @try: true));
client.OnReceiveMessageAsync += Client_OnReceiveMessageAsync;
static async Task Client_OnReceiveMessageAsync(NaiveMqClient sender, Message message)
{
Console.WriteLine($"Received: {Encoding.UTF8.GetString(message.Data.Span)}.");
if (message.Confirm)
{
await sender.SendAsync(MessageResponse.Ok(message));
};
}
await client.SendAsync(new Subscribe("test"));
for (int i = 0; i < 1000; i++)
{
var text = $"{i}";
await client.SendAsync(new Message("test", Encoding.UTF8.GetBytes($"{i}")));
Console.WriteLine($"Sent: {text}.");
await Task.Delay(1000);
}
await client.SendAsync(new Unsubscribe("test"));
Requirements
- .NET Standard for Client and Service
- .NET 6 for Tests, Server and Management Console
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. 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. |
.NET Core | netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.1 is compatible. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.1
- Microsoft.Extensions.Logging (>= 6.0.0)
- Microsoft.Extensions.Logging.Abstractions (>= 6.0.0)
- Microsoft.Extensions.Logging.Console (>= 6.0.0)
- Naive.Serializer (>= 1.0.1)
- Newtonsoft.Json (>= 13.0.1)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
1.0.0 | 185 | 1/13/2023 |