Official release is coming soon

Scheduler

The SDK provides a flexible scheduler to do actions in a specific interval. You write your job in C# and the user of the job can configure it in the extension config (plugin.conf).

The scheduler can be configured with the plugin.conf file:

scheduler {
   enabled = true
   jobs {
      // write here your job configurations
   }
}

Writing an job

We now writing a job that logs a message.

public class HelloJob : Job {
    private static readonly LoggerInstance Logger = Log.GetLogger<HelloJob>(); // Configure a logger specified for the HelloJob

    public override void Run() {
        Log.Info("Hello World");
    }

}

Now the job is implemented but it has to be registered in the scheduler with a name in your MossExtension class. Jobs have to be registered before your extension will be initialized.

You can now configure the scheduler to run your job: In the plugin.conf set this properties:

now when your extension is started the scheduler will run your job every 5 seconds

Parameterize your job

the user can specifiy job specific options in the job configuration. In our sample we will introduce a message option:

Now you can read those option with the Options-property of the job:

You can see different examples of custom jobs in the Totletheyn plugin.

Last updated

Was this helpful?