feat(floci): model Service Bus as a child resource of AddFlociAzure - #1555
Draft
thomhurst wants to merge 2 commits into
Draft
feat(floci): model Service Bus as a child resource of AddFlociAzure#1555thomhurst wants to merge 2 commits into
thomhurst wants to merge 2 commits into
Conversation
WithServiceBus() adds a FlociAzureServiceBusResource child that enables the
floci-az Service Bus data plane (MOCKED=false, START_ON_BOOT=true) and pins
the host ports its Artemis sidecar publishes — free ports by default so
concurrent AppHosts don't collide. Referencing the child with Aspire's
standard WithReference injects the official emulator's connection-string
shape (Endpoint=sb://localhost:{port};...;UseDevelopmentEmulator=true;) so
AddAzureServiceBusClient works unchanged.
The sidecar publishes directly on the Docker host, outside Aspire's endpoint
model, so the endpoint is host-relative; the management plane stays on the
base endpoint from WithReference(azure).
Blocked on a floci-az release with start-on-boot support
(floci-io/floci-az#249, PR floci-io/floci-az#250).
Fixes CommunityToolkit#1552
Claude-Session: https://claude.ai/code/session_01K8waTF6dPtQNUmXz3i8xnG
aaronpowell
requested changes
Sep 1, 2026
Member
|
@thomhurst - are you interested in being added as a contributor and being given the CODEOWNER for the floci integration? |
Model sidecar ports as proxyless endpoints so DCP allocates them before the Floci container environment resolves.
Contributor
Author
|
Happy to be added as a contributor but not sure I'll have time to be a code owner and review all the changes if it gets busy |
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.
Fixes #1552
What
WithServiceBus()models the floci-az Service Bus AMQP data plane as a child resource ofAddFlociAzure, mirroring theWithCosmos()shape from #1546:App side is the standard flow:
builder.AddAzureServiceBusClient("servicebus").Why the shape is different from Blob/Cosmos
floci-az serves Service Bus AMQP from an Artemis sidecar container it starts itself via Docker — not from the modeled container's
:4577endpoint — so there is noEndpointReferenceto build a connection string from (the floci-io/floci-az#249 analysis). What is controllable is the sidecar's published host ports (FLOCI_AZ_SERVICES_SERVICE_BUS_AMQP_PORT/_AMQP_TLS_PORT) and, with floci-io/floci-az#250, that the namespace is listening at boot (START_ON_BOOT=true). SoWithServiceBus:FLOCI_AZ_SERVICES_SERVICE_BUS_MOCKED=false— the image default is mocked) and eager start,amqpPort/amqpTlsPortare honored,FlociAzureServiceBusResource(IResourceWithConnectionString) whose connection string is the official emulator's shape:Endpoint=sb://localhost:{amqpPort};SharedAccessKeyName=RootManageSharedAccessKey;SharedAccessKey=SAS_KEY_VALUE;UseDevelopmentEmulator=true;.One child per emulator (the ports configure the parent's environment): a second
WithServiceBus()returns the existing child; conflicting ports throw.Known limitations, called out in the docs: the endpoint is host-relative (
localhost) since the sidecar publishes outside Aspire's endpoint model — sibling-container consumers would need the Docker-network address; andServiceBusAdministrationClientstays on the base emulator endpoint (WithReference(azure)), as the two planes live on different ports.Tests
AzureServiceBusResourceTests— 7 tests: child creation + parent relationship, random distinct ports, explicit ports, parent env enablement, connection-string shape, idempotent second call + port-conflict throw,WithReferenceinjection on a consumer. All green locally;TypeScriptAppHostTests.TypeScriptAppHostCompilesAndStartsfails identically on an unmodified checkout here (local Aspire CLI 13.5.2 vs SDK 13.5.0), so deferring to CI for that one.API surface regenerated (
-t:GenAPIGenerateReferenceAssemblySource), README updated with C# + TypeScript examples.https://claude.ai/code/session_01K8waTF6dPtQNUmXz3i8xnG