-
Notifications
You must be signed in to change notification settings - Fork 0
fix(messaging): correct ASB subscription-listener API + emulator/AutoProvision docs (#148) #158
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -46,8 +46,10 @@ | |
| // | ||
| // Subscription naming: `{consumer}-{source-events}-sub`. Aspire 13 requires subscription names | ||
| // to be globally unique within the bus namespace (not scoped per topic), hence the source | ||
| // suffix. The strings here must match the `ListenToAzureServiceBusSubscription("{topic}/{sub}")` | ||
| // calls in each service's Program.cs. | ||
| // suffix. The names here must match the | ||
| // `ListenToAzureServiceBusSubscription("{sub}", c => c.TopicName = "{topic}")` calls in each | ||
| // service's Program.cs — the subscription name and topic are SEPARATE args, NOT a combined | ||
| // "{topic}/{sub}" string (that form silently mis-registers the listener). See CLAUDE.md + #148. | ||
| var orderEventsTopic = serviceBus.AddServiceBusTopic("order-events"); | ||
| orderEventsTopic.AddServiceBusSubscription("payment-orders-sub"); // PaymentService consumes | ||
| orderEventsTopic.AddServiceBusSubscription("notify-orders-sub"); // NotificationService consumes | ||
|
|
@@ -115,14 +117,19 @@ static IResourceBuilder<ProjectResource> WithOptionalAppInsights( | |
| .WithEnvironment("Frontend__AllowedOrigins", SpaDevOrigin); | ||
|
|
||
| // Wolverine's AutoProvision() uses the Service Bus *management* API (ServiceBusAdministrationClient) | ||
| // to create/verify topics + subscriptions at host startup. The Service Bus emulator does NOT | ||
| // implement the management API — only the AMQP data plane — so AutoProvision retries, times out, | ||
| // and the host dies with `BrokerInitializationException: Unable to initialize the Broker asb in | ||
| // time`. Locally the topology is already declared above (AddServiceBusTopic/AddServiceBusSubscription | ||
| // write the emulator's config), so provisioning is both impossible AND redundant. Disable it for | ||
| // the four Wolverine services in dev; in Publish mode against real Azure, AutoProvision stays on | ||
| // to create/verify topics + subscriptions at host startup. The 2.0.0 emulator DOES implement the | ||
| // management API (on its 'emulatorhealth' HTTP endpoint, port 5300) — but its SUBSCRIPTION admin | ||
| // endpoints return HTTP 500 (topics + queues return 200). So AutoProvision's per-subscription | ||
| // SubscriptionExistsAsync/CreateSubscriptionAsync calls fail and the host dies with | ||
| // `BrokerInitializationException: Unable to initialize the Broker asb in time`. Locally the topology | ||
| // is already declared above (AddServiceBusTopic/AddServiceBusSubscription write the emulator's | ||
| // Config.json, which the emulator provisions at container start), and Wolverine's listener attaches | ||
| // over AMQP — which works — so provisioning is both impossible AND redundant. (Decompiled proof: | ||
| // AzureServiceBusSubscription.InitializeAsync only calls the 500-ing SetupAsync when AutoProvision | ||
| // is true; with it false, the listener binds over AMQP with no management call.) Disable it for the | ||
| // four Wolverine services in dev; in Publish mode against real Azure, AutoProvision stays on | ||
| // (Wolverine:AutoProvision defaults true) to create the entities. Mirrors the test harnesses' | ||
| // `Wolverine:AutoProvision=false`. See CLAUDE.md. | ||
| // `Wolverine:AutoProvision=false`. See CLAUDE.md + #148. | ||
| const string disableAutoProvision = "Wolverine__AutoProvision"; | ||
|
Comment on lines
+120
to
133
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Publish-mode AutoProvision behavior is contradicted by current env injection. Line 130 says AutoProvision stays enabled in publish mode, but Lines 144, 151, 159, and 165 set Suggested fix const string disableAutoProvision = "Wolverine__AutoProvision";
+var autoProvisionValue = builder.ExecutionContext.IsPublishMode ? "true" : "false";
@@
.WithReference(realm, configurationPrefix: keycloakConfigPrefix).WaitFor(realm)
.WithEnvironment("Frontend__AllowedOrigins", SpaDevOrigin)
- .WithEnvironment(disableAutoProvision, "false");
+ .WithEnvironment(disableAutoProvision, autoProvisionValue);
@@
.WithReference(realm, configurationPrefix: keycloakConfigPrefix).WaitFor(realm)
- .WithEnvironment(disableAutoProvision, "false");
+ .WithEnvironment(disableAutoProvision, autoProvisionValue);
@@
.WithReference(realm, configurationPrefix: keycloakConfigPrefix).WaitFor(realm)
.WithEnvironment("Frontend__AllowedOrigins", SpaDevOrigin)
- .WithEnvironment(disableAutoProvision, "false");
+ .WithEnvironment(disableAutoProvision, autoProvisionValue);
@@
WithOptionalAppInsights(
builder.AddProject<Projects.NotificationService>("notification-service")
.WithReference(serviceBus).WaitFor(serviceBus), appInsights)
- .WithEnvironment(disableAutoProvision, "false");
+ .WithEnvironment(disableAutoProvision, autoProvisionValue);🤖 Prompt for AI Agents |
||
|
|
||
| // OrderService also references catalogService — that gives it the gRPC client config to call | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CLAUDE.md size now blocks CI merge.
BUILD_AND_TEST / buildis failing because this file crossed the 500-line hard cap. Move detailed rationale to a paired doc/skill and keep only concise rule headlines + links here.As per coding guidelines, CLAUDE.md must stay lean and CI enforces a hard fail at 500 lines.
🤖 Prompt for AI Agents
Sources: Coding guidelines, Pipeline failures