Korjn.Amqp.Client
9.0.3
Suggested Alternatives
dotnet add package Korjn.Amqp.Client --version 9.0.3
NuGet\Install-Package Korjn.Amqp.Client -Version 9.0.3
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="Korjn.Amqp.Client" Version="9.0.3" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Korjn.Amqp.Client" Version="9.0.3" />
<PackageReference Include="Korjn.Amqp.Client" />
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 Korjn.Amqp.Client --version 9.0.3
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Korjn.Amqp.Client, 9.0.3"
#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 Korjn.Amqp.Client@9.0.3
#: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=Korjn.Amqp.Client&version=9.0.3
#tool nuget:?package=Korjn.Amqp.Client&version=9.0.3
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
Korjn.Amqp.Client
appsettings.json
{
"AmqpClient":{
"Artemis": {
"Host": "xxx.xxx.xxx.xxx",
"Port": "5672",
"CredentialFile":"login.json"
},
"MqQPid": {
"Host": "xxx.xxx.xxx.xxx",
"Port": "5675",
"CredentialFile":"login.json"
}
}
}
// or default
{
"AmqpClient":{
"Host": "xxx.xxx.xxx.xxx",
"Port": "5672",
"CredentialFile":"login.json"
}
}
Service registration
using Korjn.Amqp.DependencyInjection;
...
var builder = Host.CreateApplicationBuilder(args);
// default
builder.Services.AddAmqpClient(options =>
{
builder.Configuration.GetRequiredSection("AmqpClient").Bind("Artemis", options);
});
// keyed services
/*builder.Services.AddAmqpClient("Artemis", options =>
{
builder.Configuration.GetRequiredSection("AmqpClient").Bind("Artemis", options);
});*/
...
Injection
using Korjn.Amqp;
namespace DependencyInjection.Example;
public class Worker(ILogger<Worker> logger,
/*default*/ IAmqpClient amqpClient,
//[FromKeyedServices("Artemis")] IAmqpClient amqpClient,
IConfiguration configuration) : BackgroundService
{
private readonly ILogger<Worker> _logger = logger;
private readonly IAmqpClient amqpClient = amqpClient;
private readonly IConfiguration configuration = configuration;
private async ValueTask<bool> HandleMessage(AmqpMessage message)
{
//_logger.LogTrace("{message}", message);
await Task.Delay(500);
return true;
}
/*private async ValueTask<bool> HandleMessage(Message message)
{
await Task.Delay(500);
return true;
}*/
protected override async Task ExecuteAsync(CancellationToken stoppingToken)
{
await Task.Delay(TimeSpan.FromSeconds(1), stoppingToken);
_logger.LogInformation("Worker running at: {time}", DateTimeOffset.Now);
var reciever = amqpClient.CreateReceiver("test-receiver", "test::qtasks");
var channel = reciever.CreateChannel(50, _logger);
var taskCount = int.Parse(configuration["ThreadCount"] ?? "20");
var tasks = Enumerable.Range(0, taskCount).Select(i => channel.ConsumeAsync(HandleMessage, stoppingToken)).ToArray();
await reciever.ReceiveAsync(channel.Writer, stoppingToken);
Task.WaitAll(tasks, stoppingToken);
}
}
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net9.0 is compatible. 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.
-
net9.0
- AMQPNetLite.Core (>= 2.4.11)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.