-
-
Notifications
You must be signed in to change notification settings - Fork 259
Description
Describe the bug
Wolverine seems to struggle with correctly configuring queues in multi-tenant scenarios.
In my solution, multiple projects communicate via Wolverine using RabbitMQ transport. The main project (multi-tenant) is centrally deployed, while other applications are deployed per tenant.
In the main project, I'm using UseConventionalRouting(). With this setup:
-
Exchanges are correctly created per tenant.
-
Queues, however, are only created on the default broker connection, not per tenant.
I then switched to a manual routing configuration (see code below). The issue persists:
-
Wolverine correctly creates the queue on the default broker.
-
For tenants, it creates the queue but does not bind the configured exchanges.
-
It appears the queue configuration callback is not applied for tenant-specific brokers.
Reproduction Code
builder.UseWolverine(opts =>
{
var config = opts.UseRabbitMq(
new Uri(builder.Configuration.GetConnectionString("RabbitMQ")!)
)
.AutoProvision()
.EnableWolverineControlQueues()
.TenantIdBehavior(TenantedIdBehavior.TenantIdRequired);
var tenants = builder
.Configuration.GetRequiredSection("Tenants")
.Get<IEnumerable<TenantConfiguration>>()!;
foreach (var tenant in tenants)
{
config.AddTenant(tenant.Id.ToString(), new Uri(tenant.RabbitMQConnectionString));
}
opts.ListenToRabbitQueue("Queue1", conf =>
{
conf.BindExchange("Exchange1");
conf.BindExchange("Exchange2");
});
opts.PublishAllMessages().ToRabbitExchange("ShopFloorInterface");
opts.Policies.DisableConventionalLocalRouting();
opts.Policies.UseDurableInboxOnAllListeners();
opts.Policies.UseDurableOutboxOnAllSendingEndpoints();
});
Expected behavior
For each tenant broker, the Queue1 should be created and have both Exchange1 and Exchange2 bound to it, as defined in the configuration callback.
Additional context
Wolverine version: 4.10.0
RabbitMQ transport
Multi-tenant setup with custom broker URIs