netNinja.ServiceBus 1.0.7

dotnet add package netNinja.ServiceBus --version 1.0.7
                    
NuGet\Install-Package netNinja.ServiceBus -Version 1.0.7
                    
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="netNinja.ServiceBus" Version="1.0.7" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="netNinja.ServiceBus" Version="1.0.7" />
                    
Directory.Packages.props
<PackageReference Include="netNinja.ServiceBus" />
                    
Project file
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 netNinja.ServiceBus --version 1.0.7
                    
#r "nuget: netNinja.ServiceBus, 1.0.7"
                    
#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 netNinja.ServiceBus@1.0.7
                    
#: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=netNinja.ServiceBus&version=1.0.7
                    
Install as a Cake Addin
#tool nuget:?package=netNinja.ServiceBus&version=1.0.7
                    
Install as a Cake Tool

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:

  1. SendMessageAsync: Send a Single message
    await _serviceBusClientWrapper.SendMessageAsync("basic nuget");
  1. 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);
  1. 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);
  1. 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 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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.7 118 10/28/2024
1.0.6 98 10/28/2024
1.0.5 106 10/28/2024
1.0.4 98 10/28/2024
1.0.3 104 10/25/2024
1.0.2 96 10/25/2024
1.0.1 96 10/25/2024
1.0.0 104 10/24/2024