Skip to content

safestak-keith/AzureBusDepot

Repository files navigation

Azure Bus Depot

Motivation

A compact, opinioned but extensible .Net Standard SDK for Azure Service Bus which aims to tackle the cross-cutting concerns of:

Getting Started

  1. Install the package AzureBusDepot from nuget
  2. Define implementations of IMessageHandler<TMessage> for your message types (see sample)
  3. Define implementations of IEndpointHandlingConfig for every Azure Service Bus endpoint you want to to listen to. As a consumer it is a bit of work but these unique config types are required to play nice with dependency injection and reduces a whole lot of boilerplate bootstrapping code.

Single Message Type expected from a Queue / Topic Subscription

Add the following to ConfigureServices((hostContext, services) =>{...}) of a Generic HostBuilder.

services
    .AddAzureBusDepot<JsonMessageSerialiser>()
    .ConfigureSingleMessageTypeListener<MyEndpointHandlingConfig, MyEvent, MyEventHandler>(endpointConfig)
    .AddApplicationInsights(appInsightsOptions);

Multiple Message Types expected from a Queue / Topic Subscription

Add the following to ConfigureServices((hostContext, services) =>{...}) of a Generic HostBuilder.

services
    .AddAzureBusDepot<JsonMessageSerialiser>()
    .ConfigureMessageListenerWithPropertyBasedDispatcher(
        endpointConfig, "NServiceBus.EnclosedMessageType")
    .AddMessageHandler<MyEvent, MyEventHandler>()
    .AddMessageHandler<MyOtherEvent, MyOtherEventHandler>()
    .AddApplicationInsights(appInsightsOptions);

Samples

Samples can be found under the samples folder.

Contributing

Please see the contributing document.

About

A compact, opinioned but extensible .Net Standard SDK for Azure Service Bus

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages