Skip to content

Conversation

bording
Copy link
Member

@bording bording commented Sep 18, 2025

This PR adds support for FunctionsApplicationBuilder by adding AddNServiceBus extensions methods for IHostApplicationBuilder.

Note

The previous IHostBuilder extension methods are named UseNServiceBus, but Add seems to be the more correct pattern to follow at this point, so the I decided to use Add for the new methods instead keeping it consistent.

@bording bording force-pushed the functions-application-builder branch from ec04e93 to d1dfe23 Compare September 22, 2025 20:00
@bording bording marked this pull request as ready for review September 22, 2025 20:55
public static Microsoft.Extensions.Hosting.IHostApplicationBuilder AddNServiceBus(this Microsoft.Extensions.Hosting.IHostApplicationBuilder builder, string endpointName, System.Action<Microsoft.Extensions.Configuration.IConfiguration, NServiceBus.ServiceBusTriggeredEndpointConfiguration> configurationFactory) { }
public static Microsoft.Extensions.Hosting.IHostApplicationBuilder AddNServiceBus(this Microsoft.Extensions.Hosting.IHostApplicationBuilder builder, string endpointName, string connectionString, System.Action<Microsoft.Extensions.Configuration.IConfiguration, NServiceBus.ServiceBusTriggeredEndpointConfiguration> configurationFactory) { }
public static Microsoft.Extensions.Hosting.IHostApplicationBuilder AddNServiceBus(this Microsoft.Extensions.Hosting.IHostApplicationBuilder builder, string endpointName, string connectionString = null, System.Action<NServiceBus.ServiceBusTriggeredEndpointConfiguration> configurationFactory = null) { }
public sealed class <G>$605D8CCF64349EA050C790D67C500BD9
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment: I know this is not part of your implementation, but it is a bummer that it adds a hashed value here.

/// <summary>
/// Configures an NServiceBus endpoint that can be injected into a function trigger as a <see cref="IFunctionEndpoint"/> via dependency injection.
/// </summary>
public IHostApplicationBuilder AddNServiceBus(Action<IConfiguration, ServiceBusTriggeredEndpointConfiguration> configurationFactory)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Question: I know again you didn't directly wrote this, but do you happen to know why on some of the extensions we set the default value of configurationFactory to null? I expected for all to have the start value or none of them.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants