BabelQueue.MassTransit 1.0.0

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

BabelQueue for MassTransit

CI NuGet License: MIT

Polyglot Queues, Simplified. A MassTransit adapter that makes your MassTransit services produce and consume the canonical BabelQueue envelope — so they exchange messages with the Laravel, Symfony, Python, Go, Node and Java SDKs over one strict JSON format.

This is the MassTransit adapter on top of BabelQueue.Core: a System.Text.Json converter (byte-for-byte canonical envelopes), an ergonomic publisher and configuration helpers. The full standard is documented at babelqueue.com.

Installation

dotnet add package BabelQueue.MassTransit

Targets .NET 8; requires MassTransit 8+.

How it works

MassTransit normally wraps messages in its own envelope. This adapter registers a System.Text.Json converter that encodes/decodes the canonical BabelQueue envelope via the core codec and switches the bus to MassTransit's raw JSON serializer — so the bytes on the wire are exactly what every other BabelQueue SDK produces and consumes.

using BabelQueue.MassTransit;

builder.Services.AddMassTransit(x =>
{
    x.UsingRabbitMq((context, cfg) =>
    {
        cfg.UseBabelQueueEnvelopes();   // canonical envelope on the wire (raw JSON)
        cfg.ConfigureEndpoints(context);
    });
});

builder.Services.AddBabelQueuePublisher(defaultQueue: "orders");

Produce

using BabelQueue.MassTransit;

public class Orders(BabelQueuePublisher babelQueue)
{
    public Task Create() =>
        babelQueue.PublishAsync(
            "urn:babel:orders:created",
            new Dictionary<string, object?> { ["order_id"] = 1042L },
            "orders");
}

The queue receives the canonical envelope:

{
  "job": "urn:babel:orders:created",
  "trace_id": "…",
  "data": { "order_id": 1042 },
  "meta": { "id": "…", "queue": "orders", "lang": "dotnet", "schema_version": 1, "created_at": 1749132727000 },
  "attempts": 0
}

Consume

A consumer receives the decoded Envelope; route by URN:

using BabelQueue;
using MassTransit;

public class OrderConsumer : IConsumer<Envelope>
{
    public Task Consume(ConsumeContext<Envelope> context)
    {
        var envelope = context.Message;
        if (!EnvelopeCodec.Accepts(envelope))
            return Task.CompletedTask;

        switch (EnvelopeCodec.Urn(envelope))
        {
            case "urn:babel:orders:created":
                // handle envelope.Data, envelope.TraceId …
                break;
        }
        return Task.CompletedTask;
    }
}

Standalone converter

The converter works with any System.Text.Json usage (not just MassTransit):

var options = new JsonSerializerOptions().AddBabelQueueEnvelopes();
string wire = JsonSerializer.Serialize(envelope, options); // == EnvelopeCodec.Encode(envelope)

License

MIT © Muhammet Şafak

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.0 0 6/7/2026
0.1.0 33 6/6/2026