-
Notifications
You must be signed in to change notification settings - Fork 81
Description
Feature Request: Dynamic Topic Provisioning for Azure Service Bus
Use Case:
We have a scenario where a generic message type is published with a default topic configured:
mbb.Produce<SomeMessage>(x.DefaultTopic("topic-default"));
However, based on runtime logic, the message needs to be sent to a different topic dynamically:
await bus.Publish(new SomeMessage(), path: logic ? "topic-a" : "topic-b");
Currently, this does not work as expected. Only the topic specified in the .DefaultTopic()
call (topic-default
) is provisioned at startup. As a result, trying to publish to topic-a
or topic-b
results in an EntityNotFound
exception, since those topics are not pre-provisioned.
Proposal:
Enhance the Publish()
method to catch the EntityNotFound
exception thrown by Azure Service Bus. If this exception is detected, attempt to provision the missing topic or queue dynamically before retrying the publish operation.
This would enable greater flexibility when routing messages based on runtime logic without requiring all potential topics to be defined and provisioned upfront.