Bind DocumentPublishingFunction to ServiceBusReceivedMessage#19
Merged
Conversation
Drops the `string body` binding in favour of the full ServiceBusReceivedMessage so the function has direct access to MessageId, DeliveryCount, EnqueuedTime, and ApplicationProperties without going back through the runtime's binding context. While the new fields were in hand, enriched the DocumentPublished custom event: - Properties.MessageId - Properties.DeliveryCount (useful for observing retry behaviour) - Metrics.enqueueLatencyMs (publisher -> processed wall time) Same fields tagged onto the function's invocation Activity so the end-to-end map shows them. Tests now call `ProcessAsync` directly (mirrors DeadLetterHandler test pattern) so we don't need to mock ServiceBusReceivedMessage. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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.
Summary
Drops the
string bodybinding onDocumentPublishingFunction.Runin favour of the fullServiceBusReceivedMessage, mirroring howDeadLetterHandlerFunctionalready binds. Gives the function direct access to:MessageIdDeliveryCount(retry counter)EnqueuedTime(publisher → processed wall latency)ApplicationProperties(where theDiagnostic-Idlives, even though the AI extension already extracts it)Enriches the
DocumentPublishedcustom event accordingly:Properties.MessageIdProperties.DeliveryCountMetrics.enqueueLatencyMsSame fields tagged onto the function's invocation
Activity(messaging.servicebus.message_id,messaging.servicebus.delivery_count).Tests now call the internal
ProcessAsyncdirectly (same pattern asDeadLetterHandlerFunctionTests), so we don't need to mock or model-factory aServiceBusReceivedMessage. New assertions cover the added dimensions/metrics.Test plan
dotnet build— clean.dotnet format --verify-no-changes— clean.dotnet test tests/Function.Tests— 13/13 pass.function-appworkflow ships the new binding. Then re-run a publisher event or the integration workflow and confirm the new event carriesMessageId,DeliveryCount, andenqueueLatencyMs.🤖 Generated with Claude Code