Repository navigation
Named-connection overloads for every transport (Aspire parity, GH-5126) - #5159
Merged
Merged
Conversation
…named connection string once the container is built and hands it to the transport Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ddNamedAzureServiceBusBrokerUsingNamedConnection Accepts both shapes Aspire supplies: a full (emulator) connection string, or a namespace endpoint secured through a TokenCredential (DefaultAzureCredential by default). EntityPath is dropped. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Pulsar: service URL (pulsar://, pulsar+ssl://, host:port) - MQTT (shared source with Mqtt5): mqtt://, mqtts://, ws(s)://, host:port, user:pass@ credentials; Aspire method AddMosquitto (CommunityToolkit) - GCP Pub/Sub: emulator endpoint only (CommunityToolkit AddFlociGcp); the project id stays explicit because endpoint URIs bake it in at configuration time Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…clients from the container - Use/AddNamed...UsingNamedConnection: the value is the emulator service URL that LocalStack's AddLocalStack and the CommunityToolkit's AddFlociAws supply; placeholder credentials unless set explicitly - ...WithClient(s)FromContainer: use IAmazonSQS / IAmazonSimpleNotificationService registered by AddAWSService<T>(); container-owned clients are not disposed by Wolverine - Aspire.Hosting.AWS supplies no connection string, so real AWS stays on UseAmazonSqsTransport() or the from-container overloads Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- NATS: nats://[user:pass@]host:port as Aspire's AddNats supplies; optional configure for auth/TLS/JetStream - Redis: StackExchange.Redis configuration string as Aspire's AddRedis supplies; the IConnectionMultiplexer from Aspire's client integration is already covered by UseRedisTransport(Func<IServiceProvider, IConnectionMultiplexer>) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Oct 25, 2026
This was referenced Oct 27, 2026
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.
Closes #5126
Every Wolverine transport can now be configured by connection-string name, the way Aspire passes resources to a project (
builder.AddProject(...).WithReference(resource)puts the value atConnectionStrings:<name>). Every broker that supports named brokers gets a matching named-broker form. This is additive only: new overloads, and no change to how existing ones behave.Naming
The issue spells the API as
UseX(string connectionStringName). What shipped follows the existingUseRabbitMqUsingNamedConnection/UseKafkaUsingNamedConnectionconvention,Use<X>UsingNamedConnection(name, ...), plusAddNamed<X>BrokerUsingNamedConnection(broker, name, ...). A bareUseX(string)would collide with the existingUseX(string connectionString)overloads.Core: one hook for every transport
options.ApplyNamedConnectionString(kind, name, aspireMethod, value => ...)inNamedConnectionStringExtensions:MissingNamedConnectionStringsException, and the message names the Aspirebuilder.AddX("name")fix.IConfigurationand passes it to the callback. The callback captures the transport instance, which is why this works for named brokers; the earlier Kafka/RabbitMQ per-transport DI singletons don't.WolverineRuntime.ApplyNamedConnectionStrings()does this, and it runs once at each of these points:WolverineSystemPart.FindResources(), soresources setup/check/...also see the value without the host starting.check-envregistration, for the AOT reason documented inNamedConnectionStringExtensions.Per transport
https://ns.servicebus.windows.net:443/) secured with aTokenCredential(defaultDefaultAzureCredential).EntityPathis dropped.ServiceBusClient, the transport also needs an admin client built from the same credentials, and it disposes its client.http://localhost:4566) from LocalStack'sAddLocalStackor the CommunityToolkit'sAddFlociAws. Placeholder credentials are used unless set explicitly.Aspire.Hosting.AWSsupplies no connection string, so real AWS uses the plain overloads or:UseAmazonSqsTransportWithClientFromContainer/UseAmazonSnsTransportWithClientsFromContainer(+ named-broker forms) take theIAmazonSQS/IAmazonSimpleNotificationServiceregistered byAddAWSService<T>(). Wolverine does not dispose container-owned clients.nats://[user:pass@]host:port(AddNats). Optionalconfigurefor auth/TLS/JetStream.NatsTransportowns its connection: it disposes it, recreates closed connections on retry, and applies its own options. Possible follow-up.AddRedis)UseRedisTransport(Func<IServiceProvider, IConnectionMultiplexer>)pulsar://,pulsar+ssl://orhost:port. Neither official Aspire nor the CommunityToolkit has a Pulsar integration, so the error names no Aspire method.mqtt://host:portfrom the CommunityToolkit'sAddMosquitto, plusmqtts://,ws(s)://,host:portanduser:pass@credentialsAddFlociGcp(http://host:port). The project id remains an explicit argument, because endpoint URIs include it at configuration time. Emulator only; production usesUsePubsub.Each transport's existing
configurelambdas still apply immediately. I checked each transport, and none reads its connection settings beforeConnectAsync/InitializeAsync(or the lazy client builders); details are in the commit messages.Tests
Each transport test project has a new
named_connection_5126class. Each covers:StubAllExternalTransports(), so no broker is needed);The happy-path snippets are wrapped in
#region sample_<transport>_using_named_connection/..._named_broker_using_named_connectionfor the docs (#5156).Local results:
named_connection_string_binding_5126+named_connection_string_validation_4527: 10/10dotnet build wolverine.slnx -c Release -f net9.0: 0 errors, and the only warnings are the existing MessagePack NU1902 advisoryNot in this PR
AddNamedAzureServiceBusBroker(WolverineOptions, BrokerName, string, AzureNamedKeyCredential, ...)is missingthis, so it isn't an extension method. Addingthisis source-compatible.🤖 Generated with Claude Code