Gtlabs.ServiceBus 1.4.1

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

Gtlabs.ServiceBus

Abstractions and integrations for messaging based on Rebus/RabbitMQ. Enables automatic handler registration, dynamic routing of commands and messages, and custom serialization for interoperability between services.

Usage

Add the package to your project and register ServiceBus in the DI pipeline:

services.RegisterServiceBus(configuration);

How to implement a new Command

  1. Create a class that implements ICommand.
  2. Add the [CommandAttribute] specifying the queue name and the remote corresponding Message type.
using Gtlabs.ServiceBus.ServiceBus.Contracts;

[CommandAttribute("my-registered-queue", "Complete.Remote.Message.Namespace")]
public class MyNewCommand : ICommand
{
    public string Property { get; set; }
}

How to implement a new Message

  1. Create a class that implements IMessage.
  2. Add the [MessageAttribute] specifying the full type.
using Gtlabs.ServiceBus.ServiceBus.Contracts;

[MessageAttribute("Full.Message.Namespace")]
public class MyMessage : IMessage
{
    public int Value { get; set; }
}

Handlers

To process messages, implement a handler using IHandleMessages<T>:

using Rebus.Handlers;

public class MyNewCommandHandler : IHandleMessages<MyMessage>
{
    public async Task Handle(MyMessage message)
    {
        // Processing logic
    }
}

Handlers are automatically registered by the package.

Distributed tracing

The package propagates W3C trace context through Rebus headers:

  • traceparent
  • tracestate

Outgoing messages create producer activities and incoming message handlers create consumer activities. When Gtlabs.Logging tracing is enabled, Rebus message handling appears in the same distributed trace tree as HTTP requests and outgoing HTTP calls.

Required environment variables

  • ServiceBus:ConnectionString: RabbitMQ connection string (e.g., amqp://user:pass@host:port/vhost, usually registered in Consul K/V)
  • AppId: Unique application identifier (usually registered by Gtlabs.AppRegistration)
Product Compatible and additional computed target framework versions.
.NET net9.0 is compatible.  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.4.1 83 6/9/2026
1.4.0 106 6/7/2026