-
Notifications
You must be signed in to change notification settings - Fork 42
Update eventing docs for new AppHost helper methods #316
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
base: release/13.2
Are you sure you want to change the base?
Conversation
* Initial plan * Add WithBun() documentation to JavaScript integration page Co-authored-by: IEvangelist <7679720+IEvangelist@users.noreply.github.com> * Update Bun example to use specific version tag Co-authored-by: IEvangelist <7679720+IEvangelist@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: IEvangelist <7679720+IEvangelist@users.noreply.github.com>
) * Initial plan * Add documentation for deployment slot support to Azure App Service Co-authored-by: IEvangelist <7679720+IEvangelist@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: IEvangelist <7679720+IEvangelist@users.noreply.github.com>
- Created documentation for Azure Application Insights integration. - Created documentation for Azure Data Explorer (Kusto) integration. - Created documentation for Azure Log Analytics integration. - Created documentation for Azure Data Lake Storage integration. - Added `aspire doctor` command placeholder with redirect to main CLI command page. - Added documentation for `aspire ps` command to list running AppHost processes. - Added documentation for `aspire stop` command to stop running AppHost processes.
…LI commands and diagnostics
…#288) * Initial plan * Update ASPIRE008 diagnostic page for GenerateAssemblyInfo requirement Co-authored-by: IEvangelist <7679720+IEvangelist@users.noreply.github.com> * Update project file samples to modern 13.x format Co-authored-by: IEvangelist <7679720+IEvangelist@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: IEvangelist <7679720+IEvangelist@users.noreply.github.com>
#277) * Add polyglot AppHost documentation for TypeScript, Python, Go, Rust, and Java * feat: enhance PivotSelector component with marginTop prop for better layout control (#302) docs: update Polyglot AppHost documentation with new features and usage examples docs: add link to Polyglot AppHost in resource model documentation docs: include Polyglot AppHost reference in get-started guide for broader language support style: import utility classes for padding and margin in site CSS style: create utils.css for reusable padding and margin utility classes * fix: format project structure in polyglot AppHost documentation for clarity --------- Co-authored-by: David Pine <david.pine@microsoft.com>
- Created a new translation guide document in MDX format to assist contributors in translating the aspire.dev documentation. - Added two new images for the translation page link and language selector in both light and dark themes. - Included a detailed section on supported languages, translation status, best practices, and tips for translators.
- Added FooterPreferences component for user preferences (theme, language, keyboard shortcuts). - Introduced FooterSocials component to display social media links. - Updated Footer.astro to include new components and adjusted layout for preferences. - Enhanced Header.astro to remove theme and language selectors, now located in the footer. - Implemented auto-detection of user language on first visit in Head.astro. - Adjusted styles for new components and improved responsiveness. - Updated translations in various languages to include "preferences".
- Changed hideOnClick prop in Head.astro from 'toggle' to true for improved clarity. - Removed fixed width and height from .starlight-sidebar-topics-icon to allow for flexible sizing. - Adjusted icon size in .social-icons and .starlight-sidebar-topics-icon for consistency and better responsiveness.
…json and pnpm-lock.yaml
* Initial plan * Add documentation for .NET tool resources Co-authored-by: IEvangelist <7679720+IEvangelist@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: IEvangelist <7679720+IEvangelist@users.noreply.github.com>
…ASPIREEXTENSION001 with version notes and suppression methods
Co-authored-by: IEvangelist <7679720+IEvangelist@users.noreply.github.com>
|
Tagging @afscrome |
afscrome
left a comment
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.
A few comments. Pedantically, the ResourceEndpointsAllocatedEvent issues are not directly related to the linked PR so could be fixed in seperate PRs (potentially targeting main rather than 9.2).
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.
Given that ResourceEndpointsAllocatedEvent is deprecated, it's probably not the best first example to give of subscribing to events.
| ``` | ||
|
|
||
| The preceding code is based on the starter template with the addition of the calls to the `Subscribe` API. The `Subscribe<T>` API returns a `DistributedApplicationEventSubscription` instance that you can use to unsubscribe from the event. It's common to discard the returned subscriptions, as you don't usually need to unsubscribe from events as the entire app is torn down when the AppHost is shut down. | ||
| The preceding code is based on the starter template with the addition of calls to helper methods and the `Subscribe` API. The helper methods (`OnBeforeStart`, `OnAfterResourcesCreated`, etc.) provide a convenient way to subscribe to common AppHost lifecycle events. For events that don't have a helper method, such as `ResourceEndpointsAllocatedEvent`, you can use the `Eventing.Subscribe<T>` API. The `Subscribe<T>` API returns a `DistributedApplicationEventSubscription` instance that you can use to unsubscribe from the event. It's common to discard the returned subscriptions, as you don't usually need to unsubscribe from events as the entire app is torn down when the AppHost is shut down. |
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.
For events that don't have a helper method, such as
ResourceEndpointsAllocatedEvent, you can use theEventing.Subscribe<T>API.
The only reason ResourceEndpointsAllocatedEvent doesn't have a helper is because the event is deprecated.
| |--------------------------|-------------| | ||
| | `BeforeStartAsync()` | Subscribe to `BeforeStartEvent` | | ||
| | `BeforeStartAsync()` | Use `builder.OnBeforeStart(...)` or subscribe to `BeforeStartEvent` | | ||
| | `AfterEndpointsAllocatedAsync()` | Subscribe to `ResourceEndpointsAllocatedEvent` | |
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.
Given that ResourceEndpointsAllocatedEvent is itself deprecated, this should probably recommend subscribing to the resource specific endpoint allocated event.
| |--------------------------|-------------| | ||
| | `BeforeStartAsync()` | Subscribe to `BeforeStartEvent` | | ||
| | `BeforeStartAsync()` | Use `builder.OnBeforeStart(...)` or subscribe to `BeforeStartEvent` | | ||
| | `AfterEndpointsAllocatedAsync()` | Subscribe to `ResourceEndpointsAllocatedEvent` | |
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.
Given that ResourceEndpointsAllocatedEvent is itself deprecated, this should probably recommend subscribing to the resource level events instead, noting that is not a drop in replacement like the other events.
| // Subscribe to AfterEndpointsAllocatedEvent for resolved properties | ||
| builder.Eventing.Subscribe<AfterEndpointsAllocatedEvent>( | ||
| // Subscribe to ResourceEndpointsAllocatedEvent for resolved properties | ||
| builder.Eventing.Subscribe<ResourceEndpointsAllocatedEvent>( |
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.
The ResourceEndpointsAllocatedEvent is a resource level event rather than an app wide event, so the code sample and surrounding docs probably needs more updates than this.
Probably don't even need to use the event as you can await endpoint.GetValueAsync(), rather than having to evaluate the endpoint in ResourceEndpointsAllocatedEvent.
|
Hey @copilot, please update this based on the comments from |
…y examples Co-authored-by: IEvangelist <7679720+IEvangelist@users.noreply.github.com>
Updated in commit 6c81c49. I've addressed all of @afscrome's feedback:
The documentation now shows the recommended patterns without the deprecated/less-preferred approaches. Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
98fa033 to
e95e6d8
Compare
Aspire 13.2 introduces convenience methods for subscribing to AppHost lifecycle events (
OnBeforeStart,OnAfterResourcesCreated,OnBeforePublish,OnAfterPublish) as simpler alternatives tobuilder.Eventing.Subscribe<T>.Changes
await endpoint.GetValueAsync()instead of event subscription for accessing allocated endpoint values.Pattern
Before:
After:
For accessing allocated endpoints:
Before:
After:
Resource-specific event subscriptions (e.g.,
builder.Eventing.Subscribe<ConnectionStringAvailableEvent>(resource, handler)) remain unchanged as they have no AppHost-level equivalents.Original prompt
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.