Send-only endpoint attribute with declarative connection configuration#113
Open
andreasohlund wants to merge 24 commits into
Open
Send-only endpoint attribute with declarative connection configuration#113andreasohlund wants to merge 24 commits into
andreasohlund wants to merge 24 commits into
Conversation
Member
Author
|
@danielmarbach the source generation was not separated as expected, fixing that now |
andreasohlund
commented
Jun 3, 2026
|
|
||
| using Microsoft.Extensions.DependencyInjection; | ||
|
|
||
| file static class UsesGlobalTypes |
…on in endpoint generators
andreasohlund
commented
Jun 3, 2026
…ave a clear attribute we don't need compilation end anymore and therefore there are no races
…ctionAttribute and update references
danielmarbach
approved these changes
Jun 3, 2026
andreasohlund
commented
Jun 3, 2026
Comment on lines
+105
to
+106
| title: "Invalid NServiceBus send-only endpoint method", | ||
| messageFormat: "Method '{0}' is not a valid NServiceBus send-only endpoint: {1}", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Replaces startup-registered send-only endpoints with attribute-driven generation and adds declarative connection configuration for both trigger and send-only endpoints.
What changed
[NServiceBusSendOnlyFunction]attribute with optionalConnectionproperty to specify the configuration key used to resolve the transport connectionIConnectionSettingManifestinterface shared byFunctionManifestandSendOnlyEndpointManifest, providing a uniformConnectionSettingNamepropertyAzureServiceBusServerlessTransport.ConnectionNameinternal so that connection configuration only flows through the attribute and source generator pipelineSendOnlyEndpointGeneratorthat discovers and generates registration code for send-only endpointsAddSendOnlyNServiceBusEndpoint(...)in favor of generated registrationsbuilder.AddNServiceBusFunctions()registers both function endpoints and send-only endpoints[NServiceBusSendOnlyFunction("client", Connection = "AzureWebJobsServiceBus")]Send-only endpoint model
A send-only endpoint is defined with the
[NServiceBusSendOnlyFunction]attribute on a static configuration method:The
Connectionproperty holds the name of the configuration key (not the connection string value itself). When omitted, the transport uses its default connection name.Supported method shape:
EndpointConfigurationIServiceCollection,IConfiguration,IHostEnvironmentConfigure{EndpointName}(case-insensitive)Connection configuration flow
Both trigger-based and send-only endpoints now follow the same path for connection resolution:
Trigger-based: The
Connectionproperty on the trigger attribute (e.g.[ServiceBusTrigger(Connection = "...")]) is extracted by the source generator, flows throughFunctionManifest.ConnectionSettingName, and is applied to the transport by the registration method.Send-only: The
Connectionproperty on[NServiceBusSendOnlyFunction]is extracted by the source generator, flows throughSendOnlyEndpointManifest.ConnectionSettingName, and is applied to the transport by the registration method.Both manifests implement
IConnectionSettingManifest, so the registration method uses a single helper to apply the connection setting name to the transport.