NBraceIT.FakeMessageGen 2026.1.2

dotnet tool install --global NBraceIT.FakeMessageGen --version 2026.1.2
                    
This package contains a .NET tool you can call from the shell/command line.
dotnet new tool-manifest
                    
if you are setting up this repo
dotnet tool install --local NBraceIT.FakeMessageGen --version 2026.1.2
                    
This package contains a .NET tool you can call from the shell/command line.
#tool dotnet:?package=NBraceIT.FakeMessageGen&version=2026.1.2
                    
nuke :add-package NBraceIT.FakeMessageGen --version 2026.1.2
                    

FakeMessageGen

CI NuGet

What

This is a tool to generates fake NServiceBus messages without requiring processing first. Its purpose is to generate a large set of message for ingestion by Particular Software its ServiceControl audit and error ingestion software.

Install

This tool requires the .net sdk.

Installation:

dotnet tool install -g NBraceIT.FakeMessageGen

Update:

dotnet tool update -g NBraceIT.FakeMessageGen

Versioning

Versions follow YYYY.RELEASECOUNT.PATCH:

  • YYYY — the year of the release
  • RELEASECOUNT — the release number within that year, starting at 1
  • PATCH — hotfix number for that release, starting at 0

For example, 2026.1.0 is the first release of 2026 and 2026.1.1 a hotfix for it. Versions are derived from git tags using MinVer. Releases before 2026.1.0 used semantic versioning (1.0.0 to 2.0.0).

Release

Releases are made by pushing a version tag. The release workflow packs the tool with that version, pushes it to nuget.org and creates a GitHub release using the matching CHANGELOG.md section, so add that section first.

Publishing uses nuget.org Trusted Publishing (OpenID Connect, no stored API key). One-time setup:

  1. On nuget.org open your profile menu, Trusted Publishing, and add a policy with repository owner ramonsmits, repository FakeMessageGen, workflow file release.yml (no environment).
  2. Add the repository secret NUGET_USER containing the nuget.org profile name that owns the package (not the e-mail address).
git tag 2026.1.0
git push origin 2026.1.0

Every push and pull request is built on Linux and Windows by the CI workflow.

Help

The command line help output:

FakeMessagGen.exe destination isError [maxQueueLength] [rateLimit] [maxConcurrency] [batchSize] [connectionString]

    destination:
        The queue name to send messages to. It must already exist;
        this tool never creates queues. Start the consuming endpoint
        (for example ServiceControl) first.

    isError:
        true    — generate fake error messages.
        false   — generate fake audit messages.

    maxQueueLength (default 10000):
        Pauses sending when the destination reaches this depth.

    rateLimit (default 5000):
        Max messages per second (taking batchSize into account).

    maxConcurrency (default 100):
        Number of concurrent batches in flight.

    batchSize (default 16):
        Number of messages per batch send.

    connectionString:
        Connection to use. If not specified, the tool probes environment and config.
        Recognized formats:
            Azure Service Bus — starts with "Endpoint="
            RabbitMQ          — starts with "host="
            Learning          — path-like (/foo or C:\foo)
            MSMQ              — "msmq" (Windows only, destination can be queue@machine)

Tip: If you omit connectionString, it will try to resolve it from env or config.

Output is a full-screen UI when attached to a terminal that supports ANSI escape sequences,
and plain lines (one queue length and rate line every 2s)
when stdout is redirected or the console has no ANSI support (legacy Windows console).
Set FAKEMESSAGEGEN_PLAIN=1 to force plain lines.

The destination queue is never created by this tool: the transport is initialised with no receivers and no sending addresses, and MSMQ additionally runs with CreateQueues = false. Start the endpoint that owns the queue first — with ServiceControl that means running its setup so the audit (or error) queue exists.

Output

The tool has two output modes and picks one at startup:

Mode When What you get
Interactive stdout is a terminal that renders ANSI escape sequences Full-screen UI with a main, queue length and log frame, updated live
Plain stdout is redirected (file, pipe, scheduled task, service, CI, Start-Process -RedirectStandardOutput), the console has no ANSI support, or FAKEMESSAGEGEN_PLAIN=1 is set Startup settings, then one line every 2 seconds with the queue length and send rates, plus NServiceBus log output at Info level and above. No escape sequences

Plain output looks like this:

         Using: LearningTransport
     RateLimit: 200.00/s
     BatchSize: 16
   Destination: audit
       IsError: False
MaxQueueLength: 100,000
MaxConcurrency: 10
Press CTRL+C to exit...
2026-09-25 12:11:15 [queued:        400 Rates/sec [now:   176.0/s] [10s:    22.4/s] [1min:     3.7/s] [10min:     0.4/s] [1hr:     0.1/s] [lifetime:   190.3/s]
2026-09-25 12:11:17 [queued:        784 Rates/sec [now:   176.0/s] [10s:    60.8/s] [1min:    10.1/s] [10min:     1.0/s] [1hr:     0.2/s] [lifetime:   191.0/s]
Paused until under 100000

ANSI support on Windows is detected by asking the console to enable virtual terminal processing (SetConsoleMode with ENABLE_VIRTUAL_TERMINAL_PROCESSING). Windows Terminal has it on already; the classic console host used by cmd.exe on Windows Server supports it since Server 2016 but leaves it off until the application turns it on, which the tool now does. If enabling fails (legacy console) the tool falls back to plain output instead of printing escape sequences as garbage. On Linux and macOS a terminal is assumed to support ANSI unless TERM is empty or dumb.

Transports

Transport Connection string format Environment variable
Azure Service Bus starts with Endpoint= CONNECTIONSTRING_AZURESERVICEBUS
RabbitMQ starts with host= CONNECTIONSTRING_RABBITMQ
Learning path-like (/foo or C:\foo) CONNECTIONSTRING_LEARNING
MSMQ msmq CONNECTIONSTRING_MSMQ

When no connection string is passed, all environment variables containing CONNECTIONSTRING are probed and a selection menu is shown.

MSMQ

MSMQ is only available on Windows. The destination can be a local queue name (audit) or a remote queue (audit@machine). Messages are sent to transactional queues in one native MSMQ transaction per batch, and the queue length is read via the MSMQ management API.

The MSMQ transport is compiled in from the NServiceBus.Transport.Msmq.Sources source package (and its Particular.Msmq dependency). These packages only target net10.0-windows, and a dotnet tool cannot target a Windows specific framework, so the project downloads the packages and compiles their sources into the net10.0 build. They are only published on the Particular Software feed, which is configured in nuget.config.

Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  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.

This package has no dependencies.

Version Downloads Last Updated
2026.1.2 119 9/25/2026
2026.1.1 101 9/25/2026
2026.1.0 105 9/25/2026
2.0.0 286 1/22/2026
1.3.1 282 9/4/2025
1.3.0 250 6/16/2025
1.2.0 246 2/14/2025
1.1.0 232 2/14/2025
1.0.1 222 2/11/2025
1.0.0 215 2/11/2025

# Changelog

All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

Legend:

- 🚨 = Breaking change
- ✨ = Feature/Improvement
- 💥 = Critical bug
- 🐛 = Bug
- 📦 = Dependency update


## [Unreleased]

## [2026.1.2] - 2026-09-25

- 💥 Fixed the crash `IOException: The handle is invalid` on Windows when stdout is redirected (scheduled task, service, CI, `Start-Process -RedirectStandardOutput`). The tool now prints plain lines instead of the full-screen UI: one queue length and rate line every 2 seconds, without escape sequences
- 🐛 Fixed garbled output in `cmd.exe` on Windows Server: the tool now enables ANSI escape sequence processing on the Windows console at startup, and falls back to plain output when the console does not support it (legacy console)
- ✨ Plain output can be forced with `FAKEMESSAGEGEN_PLAIN=1`, and is used automatically when `TERM` is `dumb`
- ✨ The transport selection menu accepts piped input (reads a line when stdin is redirected instead of a key press)

## [2026.1.1] - 2026-09-25

- 💥 Fixed the MSMQ queue length check throwing `InvalidCastException` on every call. The backpressure check never completed, so no messages were sent at all and MSMQ was unusable in 2026.1.0
- ✨ The command line help and README now state that the destination queue must already exist, since the tool never creates queues
- ✨ The NuGet package now embeds an SPDX Software Bill of Materials (`_manifest/spdx_2.2/manifest.spdx.json`) listing all bundled dependencies, for supply-chain auditing
- 📦 Upgraded MinVer from 7.0.0 to 8.0.0
- 📦 Upgraded NuGet.Protocol from 7.3.1 to 7.9.0
- 📦 Upgraded NuGet.Versioning from 7.3.1 to 7.9.0

## [2026.1.0] - 2026-09-25

- ✨ Added GitHub Actions: CI build on every push and pull request (Linux and Windows), release workflow that publishes to nuget.org via Trusted Publishing (no stored API key) and creates the GitHub release when a version tag is pushed
- ✨ Version numbers now follow `YYYY.RELEASECOUNT.PATCH` (year, release number within the year, hotfix) instead of semantic versioning
- ✨ Added MSMQ transport support (Windows only) by compiling in the `NServiceBus.Transport.Msmq.Sources` source package. Select it with connection string `msmq` or the `CONNECTIONSTRING_MSMQ` environment variable
- ✨ Added `nuget.config` with the Particular Software feed as the MSMQ source packages are not published on nuget.org
- 📦 Upgraded NServiceBus from 9.2.8 to 10.2.9 (required by the MSMQ source package)
- 📦 Upgraded NServiceBus.RabbitMQ from 10.1.7 to 11.2.1
- 📦 Upgraded NServiceBus.Transport.AzureServiceBus from 5.1.2 to 6.5.0
- 📦 Upgraded Azure.Messaging.ServiceBus from 7.20.1 to 7.21.0
- 📦 Upgraded NuGet.Protocol from 7.3.0 to 7.3.1 (resolves low severity advisory GHSA-g4vj-cjjj-v7hg)

## [2.0.0] - 2026-01-22

- 🚨 Targeting .NET 10
- ✨ Added launch profiles for error and audit scenarios
- ✨ Environment variables are now ordered by key
- ✨ Enabled dependabot for automated dependency updates
- 🐛 Fix rate limit issue (using float for math and correct semaphore initialization)
- 🐛 Removed newline from version text when a new version is detected

## [1.3.1] - 2025-09-04

- 🐛 Endpoint name does not except empty string for RabbitMQ transport

## [1.3.0] - 2025-06-16

- 🐛 List started at 11, accidentally added 11 instead of 1
- ✨ Migrated from NServiceBus.Raw to NServiceBus 9.x transport seam
- ✨ Reporting version information at exit

## [1.2.0] - 2025-02-14

- ✨ Connection string options start at 1 instead of 0 making it more natural for keyboard layout
- ✨ Connection string selection only needs a key press when there are less than 10 items

## [1.1.0] - 2025-02-11

- ✨ Added ability to select auto-detected envvar connection string

## [1.0.1] - 2025-02-11

- 🐛 Fixed shutdown cancellation issue
- 🐛 Fixed terminal corruption at shutdown

## [1.0.0] - 2025-02-11

- 🥳 First sort of release roughly 4 years after the [first commit](https://github.com/ramonsmits/FakeMessageGen/commit/8c1bd0d689106962ebaefcb77b6ebbde7fea9eb5)