using CShells.Lifecycle; using Elsa.Workflows.Runtime.Options; using Elsa.Workflows.Runtime.Services; namespace Elsa.Workflows.Runtime.Lifecycle; /// /// CShells that re-applies any persisted administrative pause state when a shell /// is activated. Without this hook, a shell configured for /// pause persistence would write the persisted key on pause but never read it on subsequent reactivations — meaning /// the runtime would resume dispatching even though an operator had explicitly paused it before the previous /// shell tear-down. /// /// /// /// This is the shell-aware counterpart of InitializePauseStateStartupTask (used by IModule consumers). /// Both call , but they fire at different lifecycle /// points: /// /// /// /// /// IStartupTask runs once when the IModule host starts up. Correct for non-shell deployments, /// but in a shell-aware deployment a shell can be activated and reactivated independently of the host — /// the startup task only fires for the FIRST activation. /// /// /// /// /// runs on EVERY shell activation, including reactivations after a reload. /// This is what FR-028 requires: pause state survives every shell reactivation, not just the first. /// /// /// /// public sealed class InitializePauseStateShellInitializer(IQuiescenceSignal signal) : IShellInitializer { /// public Task InitializeAsync(CancellationToken cancellationToken = default) => signal.InitializePersistedStateAsync(cancellationToken).AsTask(); }