netNinja.ServiceBus
1.0.7
dotnet add package netNinja.ServiceBus --version 1.0.7
NuGet\Install-Package netNinja.ServiceBus -Version 1.0.7
<PackageReference Include="netNinja.ServiceBus" Version="1.0.7" />
<PackageVersion Include="netNinja.ServiceBus" Version="1.0.7" />
<PackageReference Include="netNinja.ServiceBus" />
paket add netNinja.ServiceBus --version 1.0.7
#r "nuget: netNinja.ServiceBus, 1.0.7"
#:package netNinja.ServiceBus@1.0.7
#addin nuget:?package=netNinja.ServiceBus&version=1.0.7
#tool nuget:?package=netNinja.ServiceBus&version=1.0.7
ServiceBusDealer
Usage
¿ How to inject ?
//program.cs
var serviceBusConfiguration = new ServiceBusConfiguration{
ConnectionString = Environment.GetEnvironmentVariable("SERVICEBUS_CONNECTION_STRING") ?? string.Empty,
QueueName = Environment.GetEnvironmentVariable("SERVICEBUS_QUEUENAME") ?? string.Empty
};
services.AddSingleton(serviceBusConfiguration);
services.AddTransient<IServiceBusClientWrapper<ServiceBusMessageCommand>, ServiceBusClientWrapper<ServiceBusMessageCommand>>();
Terms:
ConnectionString : connection string of your service bus , if your que has an access shared policy you should use connection string of that policy.
QueueName : name of your queue in azure.
ServiceBusMessageCommand : type of data you wish to send by ServiceBus.
Send Messages
Do not worry abot Serialize , the nuget with deal with that.
In this nuget there are 4 ways to send messages to ServiceBus:
- SendMessageAsync: Send a Single message
await _serviceBusClientWrapper.SendMessageAsync("basic nuget");
- SendListAsMessage Send a message of type List<>
var message1 = new ServiceBusMessageCommand { Message = "great day let's code", Emissor = "Robert", Receptor = "Claris" };
var message2 = new ServiceBusMessageCommand { Message = "second message for queue", Emissor = "Ramiro", Receptor = "Roberto" };
listOfMessages.Add(message1);
listOfMessages.Add(message2);
await _serviceBusClientWrapper.SendListAsMessage(listOfMessages);
- SendMessagesAsync Send several messages at the same time
var listOfMessages = new List<ServiceBusMessageCommand>();
var message1 = new ServiceBusMessageCommand { Message = "great day let's code", Emissor = "Robert", Receptor = "Claris" };
var message2 = new ServiceBusMessageCommand { Message = "second message for queue", Emissor = "Ramiro", Receptor = "Roberto" };
listOfMessages.Add(message1);
listOfMessages.Add(message2);
await _serviceBusClientWrapper.SendMessagesAsync(listOfMessages);
- SendBatchOfMessagesAsync send several messages wrapped in a Batch
var listOfMessages = new List<ServiceBusMessageCommand>();
var message1 = new ServiceBusMessageCommand { Message = "great day let's code", Emissor = "Robert", Receptor = "Claris" };
var message2 = new ServiceBusMessageCommand { Message = "second message for queue", Emissor = "Ramiro", Receptor = "Roberto" };
listOfMessages.Add(message1);
listOfMessages.Add(message2);
await _serviceBusClientWrapper.SendBatchOfMessagesAsync(listOfMessages);
5ReceiveBatchOfMessages Receive a batch of messages
/*
* @params : int maxMessagesToReceive
*/
await _serviceBusClientWrapper.ReceiveBatchOfMessages( maxMessagesToReceive )
6HandleMessage After send the message you can: complete , abandone , defer or deadLetter it.
/*
* @params :Action action , string reason , string description
*/
await _serviceBusClientWrapper.HandleMessage(action , reason , description )
public enum Action
{
Complete,
Abandon,
Defer,
DeadLetter
}
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
- Azure.Messaging.ServiceBus (>= 7.18.2)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.