Is it possible to use Masstransit with only static queues?
00:49 01 Jul 2025

In the organization I am working in we have an ActiveMQ Artemis server we use as message broker. The server is managed from an external team which demands that all queues and addresses be declared before and has disabled dynamic addresses and queues creation. Basically, all queues must be static.

In this scenario, I am trying to implement a state machine using MassTransit and to configure it according to the system requirements. So far the configuration looks like this:

services.AddMassTransit(conf =>
{
    conf.SetKebabCaseEndpointNameFormatter();
    conf.AddActivities(typeof(SampleSagaStateMachine).Assembly);
    conf.AddSagaStateMachine(
        cfg =>
        {
            cfg.UseMessageRetry(r =>
            {
                r.Handle();
                r.Handle(y => y.InnerException is SqlException e && e.Number == 2627);
                r.Incremental(5, TimeSpan.FromSeconds(1), TimeSpan.FromSeconds(20));
            });
        }
        )
        .EntityFrameworkRepository(r =>
        {
            r.ConcurrencyMode = ConcurrencyMode.Optimistic;
            r.ExistingDbContext();
            r.UseSqlServer();
        })
        .Endpoint(e =>
        {
            e.ConfigureConsumeTopology = false;
            e.Name = opts.GetEndpointOrEntityNameFor(nameof(SampleSaga));
        });

    conf.UsingActiveMq((ctx, cfg) =>
    {
        cfg.EnableArtemisCompatibility();
        cfg.ConfigureEndpoints(ctx);
    });
});

whereas the access credentials are injected using the options pattern:

services
      .AddOptions()
      .Bind(config.GetSection(nameof(ActiveMqTransportOptions)));

Everything works fine as long as I connect to a standard Artemis installation running on a docker image locally. However, as soon as I switch to the organization server and try to send a message like this:

var endpoint = await context.GetSendEndpoint(new Uri("queue:saga-queue"));
await endpoint.Send(
                new SampleEvent
                {
                    CorrelationId = context.Message.CorrelationId 
                }, default
            );

I get this error:

Apache.NMS.NMSSecurityException: AMQ229213: User: sample_user does not have permission='CREATE_NON_DURABLE_QUEUE' for queue f8597f00-44e0-45fe-b4f1-48ded333213c on address ActiveMQ.Advisory.TempQueue

So apparently disabling MassTransit default topology isn't enough to prevent queue creation.So my question is: Is there a way to disable all queue creation (and delete activities) in MassTransit so that I can use it in my scenario?

masstransit activemq-artemis