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