Default topology has changed
This version of the functions integration with Azure Service Bus uses NServiceBus.Transport.AzureServiceBus version 5 and higher. By default Azure Service Bus is configured to the default topology (using topic-per-event approach). The defaults can be overridden by adding topology options to the Application configuration
The functions integration looks for either topology options placed into AzureServiceBus:TopologyOptions
or AzureServiceBus:MigrationTopologyOptions
for migration and backward compatibility scenarios.
class Startup : FunctionsStartup
{
public override void Configure(IFunctionsHostBuilder builder)
{
builder.UseNServiceBus();
}
public override void ConfigureAppConfiguration(IFunctionsConfigurationBuilder builder)
{
builder.ConfigurationBuilder.AddJsonFile("appsettings.json", optional: false, reloadOnChange: true);
}
}
Using the default topology
{
"AzureServiceBus": {
"TopologyOptions": {
"PublishedEventToTopicsMap": {
"MyNamespace.SomeEvent": "some-event"
},
"SubscribedEventToTopicsMap": {
"MyNamespace.SomeEvent": [
"some-event",
"some-other-event"
]
},
"QueueNameToSubscriptionNameMap": {
"Publisher": "PublisherSubscriptionName"
}
}
}
}
Using the migration topology
{
"AzureServiceBus": {
"MigrationTopologyOptions": {
"TopicToPublishTo": "TopicToPublishTo",
"TopicToSubscribeOn": "TopicToSubscribeOn",
"EventsToMigrateMap": [
"MyNamespace.NotYetMigratedEvent"
],
"SubscribedEventToRuleNameMap": {
"MyNamespace.NotYetMigratedEvent": "EventRuleName"
},
"PublishedEventToTopicsMap": {
"MyNamespace.MigratedEvent": "MigratedEvent"
},
"SubscribedEventToTopicsMap": {
"MyNamespace.MigratedEvent": "MigratedEvent"
},
"QueueNameToSubscriptionNameMap": {
"Publisher": "PublisherSubscriptionName"
}
}
}
}