-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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/Stop CAP BackgroundService Manually #1238
Comments
Hello, Thanks for your feedback We plan to add public interface IBootstrapper
{
Task BootstrapAsync(CancellationToken token = default);
} |
Thank you for the reply. Can you provide more details, how that would solve the mentioned case? |
Usage see: We will release the next preview version tomorrow, you need to wait our next preview version to use. |
Oh I see the IBootstrapper will have DisposeAsync method. That`s exactly what I need. Thank you! |
Fixed in |
Hello, if (!_bootstrapper.IsStarted)
{
throw new InvalidOperationException("CAP has not been started!");
} Now, the ongoing requests (that were received just before TERM signal) and have 1 min to complete may have business logic that produces events in the end, but because bootstrapper.DisposeAsync() was called |
Hello, is there any way to stop CAP jobs (publishing, consumption, execution of received messages) at any given time manually?
Basically what I need is to stop CAP processes when CTRL+C is pressed (but wait for the ongoing executions to complete) and not wait until StopAsync method of Bootstrapper class is executed by host itself (because HostOptions.ShutdownTimeout is increased). Would it be correct to invoke StopAsync myself inside of IHostApplicationLifetime.ApplicationStopping.Register? (Some reflection would be needed to get the Bootstrapper instance, since it is internal). It is a matter of graceful shutdown.
The text was updated successfully, but these errors were encountered: