Add ServiceBusMessageActions to future proof the API#42
Merged
danielmarbach merged 4 commits intomainfrom Mar 19, 2026
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
Adds ServiceBusMessageActions to the generated Azure Functions entrypoint surface (to enable future features like native DLQ support) and removes now-unneeded recoverability/transport wrapper code.
Changes:
- Renames the message processor to
AzureServiceBusMessageProcessorand updates DI/source generation to use it. - Updates the source generator to recognize/pass
ServiceBusMessageActionsthrough to the processor. - Removes serverless recoverability policy and inlines/relocates Service Bus message header/body helpers into
PipelineInvokingMessageProcessor.
Reviewed changes
Copilot reviewed 13 out of 13 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| src/Tests.Analyzers/SetUpFixture.cs | Updates analyzer test references to the renamed processor type. |
| src/NServiceBus.AzureFunctions/Recoverability/ServerlessRecoverabilityPolicy.cs | Removes obsolete serverless recoverability policy. |
| src/NServiceBus.AzureFunctions.AzureServiceBus/Serverless/TransportWrapper/TransportMessageHeaders.cs | Removes transport header constant wrapper (now inlined elsewhere). |
| src/NServiceBus.AzureFunctions.AzureServiceBus/Serverless/TransportWrapper/MessageExtensions.cs | Removes message extension helpers (logic moved into processor). |
| src/NServiceBus.AzureFunctions.AzureServiceBus/PipelineInvokingMessageProcessor.cs | Inlines header/body extraction logic used by the transport wrapper. |
| src/NServiceBus.AzureFunctions.AzureServiceBus/FunctionsHostApplicationBuilderExtensions.cs | Registers the renamed processor type in DI keyed by function name. |
| src/NServiceBus.AzureFunctions.AzureServiceBus/AzureServiceBusMessageProcessor.cs | Renames processor and expands Process signature to include message actions. |
| src/NServiceBus.AzureFunctions.Analyzer/FunctionEndpointGenerator.Parser.cs | Extends parsing to locate ServiceBusMessageActions in function signatures. |
| src/NServiceBus.AzureFunctions.Analyzer/FunctionEndpointGenerator.Emitter.cs | Emits generated method bodies that pass message actions into the processor call. |
| src/IntegrationTest.Shipping/ShippingEndpoint.cs | Updates function signature to include ServiceBusMessageActions. |
| src/IntegrationTest.Sales/SalesEndpoint.cs | Updates function signature to include ServiceBusMessageActions and switches handler registration. |
| src/IntegrationTest.Sales/Handlers/SubmitOrderHandler.cs | Renames handler type and updates log message accordingly. |
| src/IntegrationTest.Billing/BillingFunctions.cs | Updates function signatures to include ServiceBusMessageActions. |
Comments suppressed due to low confidence (2)
src/NServiceBus.AzureFunctions.AzureServiceBus/PipelineInvokingMessageProcessor.cs:72
GetBodycan throw aNullReferenceExceptionif the transport encoding application property exists but has a null value, becausevalue.Equals(...)is called unconditionally. Consider using a safe check likevalue is string s && string.Equals(s, "wcf/byte-array", StringComparison.Ordinal)(orstring.Equals(value as string, ...)) before attempting the WCF decode.
src/NServiceBus.AzureFunctions.AzureServiceBus/AzureServiceBusMessageProcessor.cs:11- Comment grammar/style: "end user api" should be "end-user API" (and consider adding a space after
//for consistency with other comments).
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+156
to
159
| if (queueName is null || functionContextParamName is null || messageParamName is null || messageActionsParamName is null) | ||
| { | ||
| return null; | ||
| } |
| writer.Indentation--; | ||
| writer.WriteLine("}"); | ||
| writer.WriteLine($"return processor.Process({func.MessageParamName}, {func.FunctionContextParamName}, {func.CancellationTokenParamName});"); | ||
| writer.WriteLine($"return processor.Process({func.MessageParamName}, {func.MessageActionsParamName}, {func.FunctionContextParamName}, {func.CancellationTokenParamName});"); |
danielmarbach
approved these changes
Mar 19, 2026
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.
The reason for this change is that we want to have access to the lowest-level API for message settlement in order to be able to provide advanced features in the future without requiring end users to change their code.
This PR also removes the no longer needed recoverability policy, together with some consolidation of code.