Ridvay.Azure.ServiceBus.Client 5.0.1-beta

This is a prerelease version of Ridvay.Azure.ServiceBus.Client.
There is a newer version of this package available.
See the version list below for details.
dotnet add package Ridvay.Azure.ServiceBus.Client --version 5.0.1-beta                
NuGet\Install-Package Ridvay.Azure.ServiceBus.Client -Version 5.0.1-beta                
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="Ridvay.Azure.ServiceBus.Client" Version="5.0.1-beta" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Ridvay.Azure.ServiceBus.Client --version 5.0.1-beta                
#r "nuget: Ridvay.Azure.ServiceBus.Client, 5.0.1-beta"                
#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.
// Install Ridvay.Azure.ServiceBus.Client as a Cake Addin
#addin nuget:?package=Ridvay.Azure.ServiceBus.Client&version=5.0.1-beta&prerelease

// Install Ridvay.Azure.ServiceBus.Client as a Cake Tool
#tool nuget:?package=Ridvay.Azure.ServiceBus.Client&version=5.0.1-beta&prerelease                

Ridvay.Azure.ServiceBus.Client

Simple POCO/DTO driven Azure Service Bus client

Install the package

Install the Ridvay.Azure.ServiceBus.Client library for .NET with NuGet:

dotnet add package Ridvay.Azure.ServiceBus.Client

Register services

using Ridvay.Azure.ServiceBus.Client;
public void ConfigureServices(IServiceCollection services)
{
    services
    //Register the Azure Service Bus client
    .AddServiceBusClient(Configuration.GetConnectionString("ServiceBus"))
    //Register message consumers
    .AddConsumer<MyMessageConsumer>()
    .AddConsumer<MyMessageConsumerWithReturn>()
    ;
};
  

Mesage Consumers Implemention

Void message consumer


public class MyMessageConsumer : IMessageConsumer<MyBasicMessage>
{
    public Task ConsumeAsync(IMessageContext<MyBasicMessage> context)
    {
        //Do something with the message
        return Task.CompletedTask;
    }
}

Message with reply consumer

public class MyMessageConsumerWithReturn : IMessageConsumerWithReturn<MyMessage, MyReturnMessage>
{
    public MyReturnMessage ConsumeAsync(IMessageContext<MyMessage> context)
    {
        //Do something with the message
        return new MyReturnMessage();
    }
}

Send Messages

using Ridvay.Azure.ServiceBus.Client;
public class MyClass
{
    private readonly IMessageSender _sender;
    public MyClass(IMessageSender sender)
    {
        _sender = sender;
    }

    // Send a message
    public async Task SendMessage()
    {
        await _sender.SendAsync(new MyBasicMessage());
    }

    //Send a message with reply
    public async Task<MyReturnMessage> SendMessageWithReply()
    {
        return await _sender.GetAsync<MyMessage, MyReturnMessage>(new MyMessage());
    }

    // Send a scheduled message
    public async Task ScheduledSendAsync()
    {
        await _sender.ScheduleSendAsync(new MyBasicMessage(), DateTime.UtcNow.AddMinutes(15));
    }
}

Message configuration


// Default configuration
public class MyBasicMessage
{

}

// Custom configuration
[QueueConsumer(QueueName= "SomeQueueName", MaxConcurrentCalls = 50, PrefetchCount = 100, AutoCompleteMessages = false)]
public class MyMessage
{

}

Messages with manual auto completion

public class MyMessageConsumerNoAutoComplete : IMessageConsumerWithReturn<MyMessageAutoComplete>
{
   public async Task ConsumeAsync(IMessageContext<MyMessage> context)
   {
       // complete the message manually
       await context.CompleteMessageAsync();
       
       // abandon the message
       await context.AbandonMessageAsync();
   }
}
[QueueConsumer(AutoCompleteMessages = false)]
public class MyMessageAutoComplete
{

}
Product Compatible and additional computed target framework versions.
.NET net5.0 is compatible.  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. 
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
6.0.1.1 297 4/22/2023
5.0.5.6 364 1/28/2023
5.0.1-beta 223 5/27/2022
5.0.0-beta 184 5/24/2022