Fly.Shared.Messaging 1.2.1

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

Fly.Shared.Messaging

MassTransit/RabbitMQ wiring and platform event contracts for FlyOS business app integration.

Installation

<PackageReference Include="Fly.Shared.Messaging" Version="1.*" />

Note: Fly.Shared.Messaging depends on Fly.Shared.Core and will pull it in automatically.

What's Included

Extension Method

Method Description
AddFlyMessaging(services, config, configureConsumers?) Registers MassTransit with RabbitMQ transport, exponential retry (5 attempts, 1s–5min), in-memory outbox, and auto-endpoint configuration

Platform Event Contracts

All events are C# record types in Fly.Shared.Messaging.Events.

Tenant Events
Record Published By When
TenantCreated(TenantId, Slug, Name, LicensedAppIds) Controller New tenant provisioned
TenantUpdated(TenantId, Slug, Name) Controller Tenant profile changed
TenantSuspended(TenantId) Controller Tenant suspended
TenantActivated(TenantId) Controller Tenant reactivated
TenantMigrated(TenantId, NewIsolationTier) Controller Isolation tier changed
TenantProvisioningFailed(TenantId, FailedServices) Controller Provisioning rollback needed
TenantProvisioningRollback(TenantId) Controller Rollback in progress
User Events
Record Published By When
UserCreated(UserId, TenantId, Email, FirstName, LastName) Controller New user registered
UserUpdated(UserId, TenantId, Email) Controller User profile changed
UserDeactivated(UserId, TenantId) Controller User deactivated
UserRolesChanged(UserId, TenantId, Roles) Controller Role assignment changed
License Events
Record Published By When
LicenseUpdated(TenantId, LicensedApps, MaxUsers, ExpiresAt) Controller License changed
Settings Events
Record Published By When
SettingsUpdated(TenantId, AppId?, SectionKey) Controller App settings changed
UiLabelOverrideChanged(TenantId, AppId, LanguageCode) Controller UI label overrides changed
TranslationsUpdated(TenantId, LanguageCode) Controller Translations updated
CacheFallbackActivated(Service, Reason) Any service Cache fallback triggered
Service Events
Record Published By When
ServiceInitialized(TenantId, ServiceId) Business App Tenant data initialized
ServiceInitializationFailed(TenantId, ServiceId, Error) Business App Initialization failed
ServiceCallFailed(SourceService, TargetService, Endpoint, Error, CircuitState) Any service Circuit breaker opened
Notification Commands
Record Published By When
SendNotification(TenantId, Channel, RecipientUserIds, TemplateId, TemplateData) Any service Send a platform notification
SendEmail(TenantId, To, Subject, Body, IsHtml) Any service Send a transactional email

Quick Start

Register in Program.cs

var builder = WebApplication.CreateBuilder(args);

builder.Services.AddFlyCore();
builder.Services.AddFlyMessaging(builder.Configuration, x =>
{
    x.AddConsumersFromNamespaceContaining<TenantCreatedConsumer>();
    // Optional: EF Core outbox for exactly-once delivery
    x.AddEntityFrameworkOutbox<MyAppDbContext>(o => o.UseBusOutbox());
});

Implement a Consumer

using Fly.Shared.Messaging.Events;
using MassTransit;

public class TenantCreatedConsumer : IConsumer<TenantCreated>
{
    private readonly MyAppDbContext _db;

    public TenantCreatedConsumer(MyAppDbContext db) => _db = db;

    public async Task Consume(ConsumeContext<TenantCreated> context)
    {
        var tenantId = context.Message.TenantId;

        _db.MyEntities.Add(new MyEntity
        {
            TenantId = tenantId,
            Name = "Default",
            IsActive = true
        });

        await _db.SaveChangesAsync();

        // Signal back to the platform that this service is ready for this tenant
        await context.Publish(new ServiceInitialized(tenantId, "my-app"));
    }
}

Publish a Notification

using Fly.Shared.Messaging.Events;
using MassTransit;

public class ProjectService
{
    private readonly IPublishEndpoint _bus;

    public async Task NotifyAssigneeAsync(Guid tenantId, Guid userId, string projectName)
    {
        await _bus.Publish(new SendNotification(
            TenantId: tenantId,
            Channel: "in-app",
            RecipientUserIds: [userId],
            TemplateId: "project-assigned",
            TemplateData: new() { ["projectName"] = projectName }
        ));
    }
}

Configuration

Add to appsettings.json:

{
  "RabbitMQ": {
    "Host": "localhost",
    "VirtualHost": "/",
    "Username": "guest",
    "Password": "guest"
  }
}

Retry Policy

AddFlyMessaging configures exponential backoff automatically:

  • 5 retry attempts
  • Min interval: 1 second
  • Max interval: 5 minutes
  • Delta: 5 seconds per step

Dependencies

  • Fly.Shared.Core 1.x
  • MassTransit.RabbitMQ 8.x
  • Fly.Shared.Core — Multi-tenancy, auth, caching, API models. Required by this package.
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.2.1 97 4/29/2026
1.0.0 106 4/1/2026