JN.RabbitMQClient
2.1.0
See the version list below for details.
dotnet add package JN.RabbitMQClient --version 2.1.0
NuGet\Install-Package JN.RabbitMQClient -Version 2.1.0
<PackageReference Include="JN.RabbitMQClient" Version="2.1.0" />
paket add JN.RabbitMQClient --version 2.1.0
#r "nuget: JN.RabbitMQClient, 2.1.0"
// Install JN.RabbitMQClient as a Cake Addin
#addin nuget:?package=JN.RabbitMQClient&version=2.1.0
// Install JN.RabbitMQClient as a Cake Tool
#tool nuget:?package=JN.RabbitMQClient&version=2.1.0
JN.RabbitMQClient
Simple implementation of RabbitMQ consumer and sender.
This version IS NOT compatible with version 1.x.x.
Install
Download the package from NuGet:
Install-Package JN.RabbitMQClient
Usage
First, you must create the RabbitMqConsumerService
and then define delegates for ReceiveMessage
, ShutdownConsumer
and ReceiveMessageError
. The service will start the required number of consumers when StartConsumers
is called.
Example for consumer and sender services:
class Program
{
static void Main(string[] args)
{
// consumer
var consumerService = new RabbitMqConsumerService(GetBrokerConfigConsumers());
consumerService.ReceiveMessage += ReceiveMessage;
consumerService.ShutdownConsumer += ShutdownConsumer;
consumerService.ReceiveMessageError += ReceiveMessageError;
consumerService.StartConsumers("my consumer");
// sender
var senderService = new RabbitMqSenderService(GetBrokerConfigSender());
senderService.Send("my message");
Console.WriteLine("Press any key to exit...");
Console.ReadKey();
consumerService.Dispose();
}
private static IBrokerConfigSender GetBrokerConfigSender()
{
IBrokerConfigSender configSender = new BrokerConfigSender()
{
Username = "test",
Password = "123",
Host = "localhost",
VirtualHost = "/",
RoutingKeyOrQueueName = "MyTestQueue"
};
return configSender;
}
private static IBrokerConfigConsumers GetBrokerConfigConsumers()
{
IBrokerConfigConsumers configConsumers = new BrokerConfigConsumers()
{
Username = "test",
Password = "123",
Host = "localhost",
VirtualHost = "/",
RoutingKeyOrQueueName = "MyTestQueue",
ShuffleHostList = false,
Port = 0,
TotalInstances = 3
};
return configConsumers;
}
private static async Task ReceiveMessageError(string routingKeyOrQueueName, string consumerTag, string exchange, string message, string errorMessage)
{
await Console.Out.WriteLineAsync($"Error: '{consumerTag}' | {errorMessage}");
}
private static async Task ShutdownConsumer(string consumerTag, ushort errorCode, string shutdownInitiator, string errorMessage)
{
await Console.Out.WriteLineAsync($"Shutdown '{consumerTag}' | {errorCode} | {shutdownInitiator} | {errorMessage}");
}
private static async Task<Constants.MessageProcessInstruction> ReceiveMessage(string routingKeyOrQueueName, string consumerTag, long firstErrorTimestamp, string exchange, string message)
{
await Console.Out.WriteLineAsync($"Message received from '{consumerTag}': {message}");
return Constants.MessageProcessInstruction.OK;
}
}
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 | netcoreapp1.0 was computed. netcoreapp1.1 was computed. netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard1.5 is compatible. netstandard1.6 was computed. netstandard2.0 was computed. netstandard2.1 was computed. |
.NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen30 was computed. tizen40 was computed. tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 1.5
- NETStandard.Library (>= 1.6.1)
- RabbitMQ.Client (>= 5.1.2)
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 |
---|---|---|
2.5.1 | 101 | 2/16/2024 |
2.5.0 | 110 | 2/14/2024 |
2.4.3.1 | 436 | 11/2/2022 |
2.4.3 | 470 | 7/19/2022 |
2.4.2 | 428 | 5/23/2022 |
2.4.1 | 412 | 4/20/2022 |
2.4.0 | 558 | 2/7/2022 |
2.3.4 | 283 | 12/28/2021 |
2.3.3 | 377 | 10/14/2021 |
2.3.2 | 304 | 3/17/2021 |
2.3.0 | 496 | 9/4/2020 |
2.2.1 | 516 | 6/6/2020 |
2.2.0-beta.1 | 296 | 5/24/2020 |
2.2.0-beta | 304 | 5/15/2020 |
2.1.1 | 451 | 4/14/2020 |
2.1.0 | 470 | 12/19/2019 |
2.0.0 | 473 | 11/16/2019 |
1.0.1 | 513 | 6/30/2019 |
1.0.0 | 601 | 4/23/2019 |
Asynchronous consumers. This version IS NOT compatible with versions 1.x.x.
Release Notes for current version:
- new Utilities service
- possibility to create new queue when starting consumers
- bug fixes