-
Notifications
You must be signed in to change notification settings - Fork 526
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
Start to split AppExecutor, call events on restart of resources #7206
base: main
Are you sure you want to change the base?
Conversation
/azp run |
Azure Pipelines successfully started running 1 pipeline(s). |
/azp run |
Azure Pipelines successfully started running 1 pipeline(s). |
|
||
namespace Aspire.Hosting.Dcp; | ||
|
||
internal record ResourceStatus(string? State, DateTime? StartupTimestamp, DateTime? FinishedTimestamp); |
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.
Why didn't you use an interface here? Do we have multiple subscribers?
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 are never multiple subscribers for these events. Just ApplicationOrchestrator uses this to listen to changes from DCP.
Are you asking about why not an interface for DcpExecutorEvents
? There is only one implementation. The type could disappear and it becomes part of DcpExecutor
/IDcpExecutor
, but having it separated feels more usable in tests.
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’m asking why isn’t the dcp executor just calling interface methods to raise the events
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.
Had an offline discussion with @JamesNK , this enables better testing and is incremental.
166d3d6
to
bb806ac
Compare
Description
This PR is a start towards making
ApplicationExecutor
less of a monster. The newDcpExecutor
is about 400 lines smaller.ApplicationOrchestrator
. The orchestrator starts the DCP executor and subscribes to events from it. The orchestrator raises Aspire lifecycle events and publishes resource notifications. It handles managing parent/child notifications.ApplicationExecutor
toDcpExecutor
.IDcpExecutor
. AllowsApplicationOrchestrator
to be tested independently.DcpExecutorEvents
. Use by DCP executor to publish events and the orchestrator to subscribe. Copies whatDistributedApplicationEventing
does but much simplified.ResourceSnapshotPublisher
. Moves building resource snapshots from DCP resources out into a seperate file.DcpHost
. This splits the logic related to starting DCP process into its own file.DcpHostService
intoOrchestratorHostService
. The orchestrator host service starts the DCP process usingDcpHost
then starts the orchestrator.StartResourceAsync
to call the OnResourceStarting event, which then triggers Aspire lifecycle events for the resource (BeforeResourceStartedEvent
, waiting for health checks, etc)StartResourceAsync
to set a resource toFailedToStart
state if there is an exeception.TODO:
StartResourceAsync
improvementsFixes #7011
Checklist
<remarks />
and<code />
elements on your triple slash comments?breaking-change
template):doc-idea
template):