Scheduler



Web Scheduling is hosted on web backend. It allows for executing predefined jobs.
The easiest way to define your job is using code modules. But you do not need to do that if stored procedure execution is enough for you. You can use Appframe built-in jobs types like SQLProcedure or QueueProcessor.
Below is a glimpse of jobs article allowing configuration of jobs.


Scheduling allows fine-grained control of job execution. You can define weekdays you want it to run and in what frequency, seconds, minutes or days. If you want to go investigate more how jobs work go here

On top of job concept and implementation lies queues. It fulfills an asynchronous trigger promise. Go here to investigate more.

Setup

To configure Web Scheduling back end you need to supply job connection string. It needs to be configured inside web.config.

JobsConnectionString

<appSettings>

    <add key="JobsConnectionStringName" value="JobsConnectionString" />

</appSettings>

Once appSettings is configured, 'JobsConnectionString' is required in web.config.

<connectionStrings>

    <add name="JobsConnectionString" connectionString="your connection string" providerName="System.Data.SqlClient" />

</connectionStrings>

For new connection string you have to create new database login/user who has af_jobs role

Sql code to create new login/user:

create login [af_scheduler_MMDev] with password='ComplexPassword';

create user af_scheduler_MMDev from login af_scheduler_MMDev;

alter role af_user add member af_scheduler_MMDev;

alter role af_scheduler add member af_scheduler_MMDev;

HTTP module needs to be added
    
    INSERT INTO dbo.stbl_WebsiteCMS_HTTPModules (AssemblyName, TypeName)
    SELECT 'Sys.Appframe.Web.Scheduling, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null','Appframe.Web.Scheduling.HttpModule'	
    WHERE NOT EXISTS (SELECT * 
                        FROM dbo.stbl_WebsiteCMS_HTTPModules AS H WITH (NOLOCK)
                        WHERE H.AssemblyName = 'Sys.Appframe.Web.Scheduling, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null')
    
    


The jobs are executed in the context of the scheduler user so you need to make sure that it has relevant access to module data.
This can be achieved either by granting appframe role access or by bypassing appframe security in you custom security section by adding:
IF IS_ROLEMEMBER('af_Scheduler') = 1
GOTO ContinueTransaction;



Related articles

Placeholder "LocalizeWeb2016" failed