License Configuration
MassTransit v9 (and beyond) requires a license to use, which gives you a license key file. Once you receive your license key, it will look similar to the license shown below (with your own values):
-----BEGIN LICENSE KEY-----c1SDNOXHUwMDJCTUFkSVRqTExWSzMwc0xiUkxMM0JDa3ZhWUpXWFNUbXJ3N1x1MDAyQmRFRjR0WnZiblJ2WW1Wc0lpd2laVzFoYVd3aU9pSnpkRtWVc0dVpHRmxkSGQ1YkdWeVFIWnZiblJ2WW1WT2lJeU1ESMVEV5TFRBNVZEQXdPakF3T2pBd1dpSXNJbVY0Y0dseVpYTWlPaUl5TURJM0xUQXhMeyJ2ZXJzaW9uIjojEiLCJraW5kIjoiTGljZW5zZSIsIm1ldGEiOnsic2lnbmF0dXJlLWFsZ29yc0xtTnZiU0o5TENKamRYTjMjFsY2lJNmV5SnBaQ0k2SW1OMWMxOVVXbHBIYzFCUVlrOW1jRzR4T0NJc0ltNWhiV1VpT2lKQ1lXNJRlp2Ym5SdlltVnNJbjBzSW5CeWIyUjFZM1J6SWpwN0ltMWhjOXVJam9pVFdGemMxUnlZV6YVhRZ1RHbGpaVzV6WlNJc0ltVjRjR2x5WlhNaU9pSXlNREkyTFRFeUxUQTVWREF3T2pBd09qdXaUlzSW1abFlYUjFjbVZ6SWpwdWRXeHNmWDBzSW1OeVpXRjBaV1FpVEE0VkRBd09qQXdPakF3lKOSIsInNpZ25hdHVyZSI6IkFYMVRJNWE2c1dMZXVoNi9rLzcxNk8vaXRobSI6IkVDRHNhIn0sImRhdGEiJleUpqYjI1MFlXTjBJanA3SW01aGJXVWlPaUpDWVc1cklGM04wY21GdWMybDBJanA3SW01aGJXVWlPpOWVhOelZISmhibk5wZENJc0ltUmxjMk55YVhCMGFXVWJMMTF1R0libXd2YjlWR2ZhUTlkZ1FERExseDQUdrMVBvdmhaRkN2ajdWbDlQVFNiVkFFdUE3-----END LICENSE KEY-----Configure the license key
Section titled “Configure the license key”The license key can be configured in several ways, depending on your environment.
Environment variable (Key)
Section titled “Environment variable (Key)”Environment variables are a great way to store secrets and provide them to your application. They are easy to specify when using Docker or Kubernetes, both of which offer secure secret storage mechanisms.
Your license key can be set in an environment variable named MT_LICENSE and loaded automatically.
export MT_LICENSE="..."Environment variable (File)
Section titled “Environment variable (File)”You can store your license in a file and specify the file location using the MT_LICENSE_PATH environment variable. MassTransit will attempt to open and use
the license when the bus is configured.
export MT_LICENSE_PATH="/app/license.txt"Docker compose
Section titled “Docker compose”If you are running with Docker Compose, you can map a local license file into the container as a read-only volume and set MT_LICENSE_PATH to the in-container path.
producer: environment: MT_LICENSE_PATH: /masstransit/license.txt volumes: - ${HOME}/.dotnet/MassTransit/license.txt:/masstransit/license.txt:roLicense key
Section titled “License key”You can specify the license directly by calling SetLicense on the bus configurator. This allows you to store the key however you want and provide it to the
bus configuration.
services.AddMassTransit(x =>{ string licenseKey = ""; // load the key here
x.UsingRabbitMq((context, cfg) => { cfg.SetLicense(licenseKey);
cfg.ConfigureEndpoints(context); });});License file
Section titled “License file”You can store your license in a file that is deployed with your application and specify the file location by calling SetLicenseLocation on the bus
configurator.
services.AddMassTransit(x =>{ x.UsingRabbitMq((context, cfg) => { cfg.SetLicenseLocation("./license.txt");
cfg.ConfigureEndpoints(context); });});License key management
Section titled “License key management”The license key must be accessible at runtime on any machine or container that executes MassTransit code. This includes:
- Developer laptops (local builds and tests)
- CI/CD agents
- Test and staging environments
- Production deployments (VMs, containers, Kubernetes, etc.)
Subscription expiration and deployments
Section titled “Subscription expiration and deployments”MassTransit v9 licenses include perpetual downgrade rights.
- Any MassTransit version released while your subscription is active remains valid to run after expiration.
- You can redeploy, restart, and hot-fix applications that stay on that same MassTransit version.
- An active subscription is only required when upgrading to a newer MassTransit version released after the subscription end date.
This means operations teams do not need to urgently rotate or replace license configuration just because a subscription expires, as long as no upgrade to a newer MassTransit version is being deployed.
At runtime, if the subscription is expired, MassTransit logs a warning that the license is no longer current. It does not disable running services.
MassTransit does not use a central license server or activation service. MassTransit validates the license key locally within the running process to ensure reliability, offline operation, and predictable startup behavior.
Monthly subscriptions
Section titled “Monthly subscriptions”If you are on a monthly subscription, a new license key is issued each month with the new billing period.
You do not need to rotate the key in already-deployed environments every month if those environments continue running the same MassTransit version that was released during your active licensed period.
You only need to update the license in a deployed environment when you deploy a newer MassTransit version that requires the newer active license period.
In practice
Section titled “In practice”- Monthly renewal happens → a new key is generated for the current period.
- Existing deployed app stays on same MT version → no immediate license update required.
- You deploy a newer MT package version → use the current active license key for that deployment.
MassTransit licenses are local/self-contained (no runtime call-home requirement for validation), and version usage rights are tied to what was released during an active licensed period.
Treat license updates as part of your normal deployment pipeline for MassTransit version upgrades, not as a separate monthly runtime maintenance task for unchanged deployments.
License key distribution
Section titled “License key distribution”Your license key should be treated like any other secret. It should not be committed to source control or baked into container images.
Recommended key distribution approaches include:
- Environment variables
- Secret stores (Azure Key Vault, AWS Secrets Manager, HashiCorp Vault, etc.)
- Kubernetes secrets
- CI/CD secret injection (GitHub Actions, etc.)
At application startup, your application reads the license key from configuration just like a connection string or API token. This allows you to apply the license key within an environment without impact to the existing code.
Local development guidance
Section titled “Local development guidance”For local development, we recommend one of the following approaches:
- Store the license key in a local environment variable or user-specific secret store
- Use a
.envfile that is explicitly excluded from version control - Configure your IDE or local tooling to inject the license at runtime
This ensures developers can run and test MassTransit locally without exposing the license in shared repositories.
CI/CD pipelines
Section titled “CI/CD pipelines”CI/CD systems should inject the license key as a secret, either at the organization or repository level.
For containerized builds:
- Inject the license at runtime, not at container image build time
- Avoid embedding the license in Dockerfiles or base images
Reducing distribution risk
Section titled “Reducing distribution risk”Because MassTransit executes wherever your application runs, the license does need to be broadly available but it does not need to be broadly visible.
To minimize risk:
- Restrict access to secrets at the infrastructure level
- Avoid copying license values into documentation, scripts, or example configs
- Limit who can read secret values in CI/CD and production systems