I created a scheduler which is having enable / disable configuration at OSGI level. I want to move this enable / disable checkbox to Context Aware Configuration so that it can be possible to enable it for different tenants.
Is it possible to do that ?
yes, this is possible. Create a context-aware configuration and access it in the scheduler like this:
Resource contentResource = resourceResolver.getResource("/content/mysite/page1");
Resource configResource = configurationResourceResolver.getResource(contentResource, "my-bucket", "my-config");
Hope this helps.
Context aware config works based on the context (page/domain) path and OSGi config works based on repo/web console/run mode value. Scheduler which is running as a independent module will not have access to the context and it does not depend on any request or it does not know from which context the request is coming. It runs independently based on a schedule. So you will not be able to use the CAC here to manage the flag.
I think you cant move the config to context aware config rather you can use the context config in scheduler so that based on that config value your scheduler will get executed.