Skip to content

Add outbound-only Rebus composition for Azure Functions - #832

Merged
AndreaCuneo merged 4 commits into
masterfrom
copilot/next-azure-framework-task-again
Aug 3, 2026
Merged

Add outbound-only Rebus composition for Azure Functions#832
AndreaCuneo merged 4 commits into
masterfrom
copilot/next-azure-framework-task-again

Conversation

Copilot AI commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

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.

  • Outbound composition
    • Added reusable RegisterOutboundRebus setup with generated owner routing.
    • Excludes input queues, workers, subscriptions, handlers, and outbox processors.
  • Azure Functions host
    • Added Azure Service Bus transport configuration.
    • Supports managed identity via DefaultAzureCredential and externally supplied connection strings.
    • Added hosted-service lifecycle management and required local configuration.
  • Regression coverage
    • Verifies typed payload delivery through drainable in-memory one-way transport to an independently hosted receiver.
  • Documentation
    • Documented outbound-only behavior, configuration, and unsupported request/reply semantics.
    • Marked AZF-07 complete.
ApplicationComposition.RegisterOutboundRebus(
    container,
    transport => transport.UseAzureServiceBusAsOneWayClient(
        namespaceOrConnectionString,
        new DefaultAzureCredential()),
    SampleRebusEndpoints.ConfigureRouting);

Copilot AI and others added 3 commits August 3, 2026 14:59
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>
Co-authored-by: AndreaCuneo <5227688+AndreaCuneo@users.noreply.github.com>
@AndreaCuneo
AndreaCuneo marked this pull request as ready for review August 3, 2026 15:39
@AndreaCuneo
AndreaCuneo requested a review from a team as a code owner August 3, 2026 15:39
Copilot AI review requested due to automatic review settings August 3, 2026 15:39

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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;
Copilot AI requested a review from AndreaCuneo August 3, 2026 15:49
@AndreaCuneo
AndreaCuneo merged commit daec3b3 into master Aug 3, 2026
8 checks passed
@AndreaCuneo
AndreaCuneo deleted the copilot/next-azure-framework-task-again branch August 3, 2026 16:14
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