batteries.Apache.NMS 1.0.11

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

// Install batteries.Apache.NMS as a Cake Tool
#tool nuget:?package=batteries.Apache.NMS&version=1.0.11                

NuGet Version

Description

This package contains useful implementations of message bus services based on apache NMS.

Usage

With Message Bus Manager

The message bus manager can be used for managing multiple instances of message bus on different locations.

Here is how to use it:

  1. Add the setting binding

    builder.Services.AddOptions<BusManagerSettings>()
    .BindConfiguration("BusManagerSettings")
    .ValidateDataAnnotations()
    .ValidateOnStart();
    builder.Services.AddSingleton(resolver => resolver.GetRequiredService<IOptions<BusManagerSettings>>().Value);
    
    
  2. Adapt your appsettings.json and include the necessary settings:

    "BusManagerSettings":{ 
     "BusSettings":
     [
       {
         "Name": "test",
         "ServerUrl":"activemq:tcp://localhost:61616?retryInterval=1000&retryIntervalMultiplier=1.5&maxRetryInterval=60000&reconnectAttempts=1000",
         "Username": "artemis",
         "Password": "artemis",
         "DefaultDestination": "topic://fancytopic"
       }
     ],
     "Destinations": {
       "abc": "queue://abc.xyz"
     }
    }
    
  3. Add the background service

    builder.Services.AddSingleton<MessageBusManagerService>();
    
    builder.Services.AddSingleton<IHostedService, MessageBusManagerService>(serviceProvider => serviceProvider.GetService<MessageBusManagerService>());
    
    builder.Services.AddSingleton<IBusManager, MessageBusManagerService>(serviceProvider => serviceProvider.GetService<MessageBusManagerService>());
    
  4. Inject the service (for example in one controller)

    public class DataController : ControllerBase
    {
        private readonly ILogger<DataController> logger;
        private readonly IBusManager busManager;
    
        public DataController(ILogger<DataController> logger, IBusManager busManager)
        {
            this.logger = logger;
            this.busManager = busManager;
        }
    }
    

Without Message Bus Manager

The usage without the manager has very similar steps. Unter theese condition the software will ony have a single instance of the message bus.

Here is how to use it:

  1. Add the setting binding

    builder.Services.AddOptions<MessageBusSessionSettings>()
    .BindConfiguration("MessageBusSessionSettings")
    .ValidateDataAnnotations()
    .ValidateOnStart();
    builder.Services.AddSingleton(resolver => resolver.GetRequiredService<IOptions<MessageBusSessionSettings>>().Value);
    
    
  2. Adapt your appsettings.json and include the necessary settings:

    "MessageBusSessionSettings":
       {
         "Name": "test",
         "ServerUrl":"activemq:tcp://localhost:61616?retryInterval=1000&retryIntervalMultiplier=1.5&maxRetryInterval=60000&reconnectAttempts=1000",
         "Username": "artemis",
         "Password": "artemis",
         "DefaultDestination": "topic://fancytopic"
       }
    
    
  3. Add the background service

    builder.Services.AddSingleton<MessageBus>();
    
    builder.Services.AddSingleton<IHostedService, MessageBus>(serviceProvider => serviceProvider.GetService<MessageBus>());
    
    builder.Services.AddSingleton<IMessageBus, MessageBus>(serviceProvider => serviceProvider.GetService<MessageBus>());
    
  4. Inject the service (for example in one controller)

    public class DataController : ControllerBase
    {
        private readonly ILogger<DataController> logger;
        private readonly IMessageBus messageBus;
    
        public DataController(ILogger<DataController> logger, IMessageBus messageBus)
        {
            this.logger = logger;
            this.messageBus = messageBus;
        }
    }
    
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. 
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.12 0 1/23/2025
1.0.11 23 1/22/2025
1.0.10 22 1/22/2025