-
Notifications
You must be signed in to change notification settings - Fork 543
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
Introduce ResourceCreatingEvent #5359
Conversation
tests/Aspire.Hosting.Tests/Eventing/DistributedApplicationBuilderEventingTests.cs
Show resolved
Hide resolved
tests/Aspire.Hosting.Tests/Eventing/DistributedApplicationBuilderEventingTests.cs
Show resolved
Hide resolved
src/Aspire.Hosting.Azure/Provisioning/Provisioners/AzureProvisioner.cs
Outdated
Show resolved
Hide resolved
…urceCreated/AfterResourceStarted.
…ove ResourceCreated/AfterResourceStarted." This reverts commit 058f25b.
/// Resources that are created by orchestrators may not yet be ready to handle requests. | ||
/// </remarks> | ||
[Experimental("ASPIREEVENTING001", UrlFormat = "https://aka.ms/dotnet/aspire/diagnostics#{0}")] | ||
public class BeforeResourceStartedEvent(IResource resource, IServiceProvider services) : IDistributedApplicationResourceEvent |
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.
I think this name still violates the naming guidelines.
✔️ DO give events names with a concept of before and after, using the present and past tenses.
For example, a close event that is raised before a window is closed would be called Closing, and one that is raised after the window is closed would be called Closed.
❌ DO NOT use "Before" or "After" prefixes or postfixes to indicate pre- and post-events. Use present and past tenses as just described.
public class BeforeResourceStartedEvent(IResource resource, IServiceProvider services) : IDistributedApplicationResourceEvent | |
public class ResourceStartingEvent(IResource resource, IServiceProvider services) : IDistributedApplicationResourceEvent |
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.
Agree these names aren't 100% right. But we will be doing a follow up.
@@ -217,6 +220,9 @@ private async Task ProvisionAzureResources( | |||
|
|||
private async Task ProcessResourceAsync(IConfiguration configuration, Lazy<Task<ProvisioningContext>> provisioningContextLazy, IAzureResource resource, CancellationToken cancellationToken) | |||
{ | |||
var beforeResourceStartedEvent = new BeforeResourceStartedEvent(resource, serviceProvider); | |||
await eventing.PublishAsync(beforeResourceStartedEvent, cancellationToken).ConfigureAwait(false); |
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.
Are there tests that can be written for the Azure provisioning event?
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.
That component isn't currently testable
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.
😢
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.
@eerhardt we're going to rename in the follow up
Description
This PR introduces a new eventing event
ResourceCreatingEvent. This work is related to enabling
WaitFor` support.Fixes # (issue)
Checklist
<remarks />
and<code />
elements on your triple slash comments?Microsoft Reviewers: Open in CodeFlow