Skip to content

Add ServiceBusMessageActions to future proof the API#42

Merged
danielmarbach merged 4 commits intomainfrom
recoverability
Mar 19, 2026
Merged

Add ServiceBusMessageActions to future proof the API#42
danielmarbach merged 4 commits intomainfrom
recoverability

Conversation

@andreasohlund
Copy link
Member

@andreasohlund andreasohlund commented Mar 18, 2026

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.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

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 AzureServiceBusMessageProcessor and updates DI/source generation to use it.
  • Updates the source generator to recognize/pass ServiceBusMessageActions through 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

  • GetBody can throw a NullReferenceException if the transport encoding application property exists but has a null value, because value.Equals(...) is called unconditionally. Consider using a safe check like value is string s && string.Equals(s, "wcf/byte-array", StringComparison.Ordinal) (or string.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 danielmarbach merged commit 92e891f into main Mar 19, 2026
4 checks passed
@danielmarbach danielmarbach deleted the recoverability branch March 19, 2026 10:18
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.

3 participants