-
-
Notifications
You must be signed in to change notification settings - Fork 303
Description
We have a multi-tenant setup where tenants are created dynamically. So we don't know all the tenant ids when the application starts, while the application is running new tenants can be created and the application can be onboarded for the tenant (this is done by just activating the application for the tenant, without the need for a new container to be spun up). This application is responsible for configuration.
Next to that there is a new container that is started for the runner specific for that tenant and a service bus topic (on azure service bus) is created with a listener for this container.
So from the main application a message should be able to be send to that dynamicly created topic for that specific tenant. We can't seem to figure out, using tenant configuration (cause we don't know the tenant id's at build or first startup) or using the toDestination method how to configure this. Could you guide us to the right path please?
Our latest attempt was the following:
DeliveryOptions deliveryOptions = new();
// Add headers to the existing Headers dictionary
deliveryOptions.Headers.Add("runnerId", "runner-" + serviceBusRequestTopic.RunnerId);
// Dynamicly configure the tenant topic
deliveryOptions.ToDestination(new Uri($"asb://topic/tenant-{serviceBusRequestTopic.TenantId}"));
// Send the message to the topic using Wolverine
await _messageBus.SendAsync(serviceBusRequestTopic, deliveryOptions);