Add outbound-only Rebus composition for Azure Functions - #832
Merged
Conversation
Co-authored-by: AndreaCuneo <5227688+AndreaCuneo@users.noreply.github.com>
Co-authored-by: AndreaCuneo <5227688+AndreaCuneo@users.noreply.github.com>
Co-authored-by: AndreaCuneo <5227688+AndreaCuneo@users.noreply.github.com>
Copilot created this pull request from a session on behalf of
AndreaCuneo
August 3, 2026 15:27
View session
AndreaCuneo
approved these changes
Aug 3, 2026
Co-authored-by: AndreaCuneo <5227688+AndreaCuneo@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Adds an outbound-only Rebus setup for the Azure Functions sample so the Functions host can publish mediator messages without running a long-lived Rebus receiver, plus a regression test that verifies routing/payload end-to-end.
Changes:
- Introduces
ApplicationComposition.RegisterOutboundRebus(...)for one-way (send-only) Rebus composition. - Updates Azure Functions host to build/start an outbound Rebus client (Azure Service Bus) and documents required configuration + limitations.
- Adds an integration-style test that verifies typed message delivery via drainable one-way in-memory transport to an independently hosted receiver.
Reviewed changes
Copilot reviewed 12 out of 12 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| samples/Ark.MediatorFramework.Sample/test/Ark.MediatorFramework.Sample.Tests/AzureFunctionsRebusTests.cs | Adds regression test validating outbound-only routing/payload to an independent receiver. |
| samples/Ark.MediatorFramework.Sample/test/Ark.MediatorFramework.Sample.Tests/Ark.MediatorFramework.Sample.Tests.csproj | Adds package reference needed by the new Rebus test helpers. |
| samples/Ark.MediatorFramework.Sample/src/Ark.MediatorFramework.Sample.AzureFunctions/Program.cs | Switches AZF startup to outbound-only Rebus container + hosted service lifecycle wiring. |
| samples/Ark.MediatorFramework.Sample/src/Ark.MediatorFramework.Sample.AzureFunctions/packages.lock.json | Lockfile updates for new project/package dependencies. |
| samples/Ark.MediatorFramework.Sample/src/Ark.MediatorFramework.Sample.AzureFunctions/local.settings.json.example | Documents required Service Bus configuration key for local runs. |
| samples/Ark.MediatorFramework.Sample/src/Ark.MediatorFramework.Sample.AzureFunctions/AzureFunctionsRebusHostedService.cs | Starts/owns outbound bus lifecycle for the Functions process. |
| samples/Ark.MediatorFramework.Sample/src/Ark.MediatorFramework.Sample.AzureFunctions/AzureFunctionsRebusComposition.cs | Builds outbound-only Rebus container with Azure Service Bus one-way transport. |
| samples/Ark.MediatorFramework.Sample/src/Ark.MediatorFramework.Sample.AzureFunctions/Ark.MediatorFramework.Sample.AzureFunctions.csproj | Adds Rebus-related package + project references needed by the new composition. |
| samples/Ark.MediatorFramework.Sample/src/Ark.MediatorFramework.Sample.Application/ApplicationComposition.cs | Adds reusable outbound-only Rebus registration API. |
| samples/Ark.MediatorFramework.Sample/README.md | Documents outbound-only behavior and unsupported request/reply semantics for AZF sample. |
| docs/mediator-framework/progress/tasks/README.md | Marks AZF-07 as complete in progress tracker. |
| docs/mediator-framework/progress/tasks/azure-functions/AZF-07-one-way-rebus.md | Checks off AZF-07 acceptance items related to composition/routing/docs. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+29
to
+33
| public async Task StopAsync(CancellationToken cancellationToken) | ||
| { | ||
| await _container.DisposeAsync().ConfigureAwait(false); | ||
| } | ||
| } |
Comment on lines
+32
to
+34
| var container = new Container(); | ||
| ApplicationComposition.Register(container, useSqlStore: false); | ||
| ApplicationComposition.RegisterOutboundRebus( |
Comment on lines
+29
to
+32
| #pragma warning disable CA2000 // The hosted service owns and disposes the container at process shutdown. | ||
| var serviceBusConnectionString = builder.Configuration["AzureServiceBus:ConnectionString"]; | ||
| var rebusContainer = AzureFunctionsRebusComposition.BuildContainer(serviceBusConnectionString); | ||
| #pragma warning restore CA2000 |
Comment on lines
+43
to
+46
| activator.Handle<CompleteGreetingCompositionRequest>(message => | ||
| { | ||
| received.SetResult(message); | ||
| return Task.CompletedTask; |
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.
Azure Functions needs to publish mediator messages without becoming a long-running Rebus consumer. The sample lacked production-shaped one-way composition and routing verification.
RegisterOutboundRebussetup with generated owner routing.DefaultAzureCredentialand externally supplied connection strings.