Skip to content

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-----
c1SDNOXHUwMDJCTUFkSVRqTExWSzMwc0xiUkxMM0JDa3ZhWUpXWFNUbXJ3N1x1MDAyQmRFRjR0
WnZiblJ2WW1Wc0lpd2laVzFoYVd3aU9pSnpkRtWVc0dVpHRmxkSGQ1YkdWeVFIWnZiblJ2WW1W
T2lJeU1ESMVEV5TFRBNVZEQXdPakF3T2pBd1dpSXNJbVY0Y0dseVpYTWlPaUl5TURJM0xUQXhM
eyJ2ZXJzaW9uIjojEiLCJraW5kIjoiTGljZW5zZSIsIm1ldGEiOnsic2lnbmF0dXJlLWFsZ29y
c0xtTnZiU0o5TENKamRYTjMjFsY2lJNmV5SnBaQ0k2SW1OMWMxOVVXbHBIYzFCUVlrOW1jRzR4
T0NJc0ltNWhiV1VpT2lKQ1lXNJRlp2Ym5SdlltVnNJbjBzSW5CeWIyUjFZM1J6SWpwN0ltMWhj
OXVJam9pVFdGemMxUnlZV6YVhRZ1RHbGpaVzV6WlNJc0ltVjRjR2x5WlhNaU9pSXlNREkyTFRF
eUxUQTVWREF3T2pBd09qdXaUlzSW1abFlYUjFjbVZ6SWpwdWRXeHNmWDBzSW1OeVpXRjBaV1Fp
VEE0VkRBd09qQXdPakF3lKOSIsInNpZ25hdHVyZSI6IkFYMVRJNWE2c1dMZXVoNi9rLzcxNk8v
aXRobSI6IkVDRHNhIn0sImRhdGEiJleUpqYjI1MFlXTjBJanA3SW01aGJXVWlPaUpDWVc1cklG
M04wY21GdWMybDBJanA3SW01aGJXVWlPpOWVhOelZISmhibk5wZENJc0ltUmxjMk55YVhCMGFX
VWJMMTF1R0libXd2YjlWR2ZhUTlkZ1FERExseDQUdrMVBvdmhaRkN2ajdWbDlQVFNiVkFFdUE3
-----END LICENSE KEY-----

The license key can be configured in several ways, depending on your environment.

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.

Terminal window
export MT_LICENSE="..."

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.

Terminal window
export MT_LICENSE_PATH="/app/license.txt"

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);
});
});

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);
});
});

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.)

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.

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.

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 .env file 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 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

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