Confluence Server Plugin - long running background task

What is the best approach for designing a long running background task in a confluence server/data center plugin?

I tried to use the SAL API with this tutorial: https://developer.atlassian.com/server/framework/atlassian-sdk/scheduling-events-via-sal-tutorial/#step-3--import-the-sal-scheduler-component-to-the-plugin-descriptor,
but this is not working, and also noticed the atlassian sdk version in that tutorial is way old! - like 3.x. Also the classes related to PluginJob as well as PluginScheduler are now marked as deprecated.

Please advise - I need something like “Creating a support zip in Confluence” - that kind of behavior for my long running task.