Try our conversational search powered by Generative AI!

How to tell if the current instance is the scheduler app


we are upgrading to CMS 12, previously we used 


to tell if the current instance in DXC is the instance running the scheduler, we would like to do the same in the upgrade, but i cant find that property or an alternative in version 12.

Same question has asked about previous versions.

How can we programatically know if this is the instance in DXC running the scheduler. 

Nov 28, 2023 10:27

In CMS 12 configuration settings are exposed as options classes which are already registered in the IOC container. 

I haven't tried this but you should be able to simply inject IOptions<SchedulerOptions> as such

public TestClass(IOptions<SchedulerOptions> options)
        _options = options.Value;

You can then use the value for _options.Enabled for your logic

See below documentation for details

Nov 28, 2023 11:37

I can confirm this approach works.

In addition, there is a transformation step in the DXP deploy that force sets this value to Enabled = true for the scheduler instance and Enabled = false for all other instances (valid for preprod and prod), which means that you can trust this setting. If it is enabled, you're on the scheduler. Do note though that there is no scheduler instance in integration, but unless you deliberately change the value, it will be correct for integration too, since scheduler is by default enabled.

Edited, Dec 11, 2023 18:17

To visualize what both Ronil and Johan said, check the scheduler property

Or if you prefer the programmatic approach

services.Configure<SchedulerOptions>(options =>
    options.Enabled = true;

And use something like this in your code

public class SchedulerEnabled
    private readonly IOptions<SchedulerOptions> _options;

    public SchedulerEnabled(IOptions<SchedulerOptions> options)
        _options = options;

    public bool Value { get { return _options.Value.Enabled; } }
Dec 11, 2023 23:12
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.