Skip to content

Start/Stop CAP BackgroundService Manually #1238

@PoteRii

Description

@PoteRii

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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions