The maintenance framework has several mechanismes built-in that enable you to
limit the execution of a maintenance job to specific servers.
This is useful if only a few servers have the necessary software installed to
execute these maintenance jobs successfully.
Let's briefly explain the options:
- Priority: this is the option that most developers know because it has been a
feature of ADAM since version 3. When executing the maintenance manager using
Adam.Core.CommandLine, one can use the -priorities argument to control which
maintenance job priorities should be executed.
To create such a job, simply set the Priority-property:RecordMaintenanceJob job = new RecordMaintenanceJob(app);
job.AddNew();
job.Targets.Add(new RecordMaintenanceTarget(someRecordId));
job.Actions.Add(new UpdateFullTextAction());
job.Priority = 43;
job.Save();
To execute only jobs of certain priorities:
Adam.Core.CommandLine RunMaintenanceJobs -priorities=10-20,40-50
- Machine Affinity: Since ADAM 4.4, we have a feature that allows you to limit the
execution of a maintenance job to one specific server. All you need to do is set
two properties when submitting the job:
RecordMaintenanceJob job = new RecordMaintenanceJob(app);
job.AddNew();
job.Targets.Add(new RecordMaintenanceTarget(someRecordId));
job.Actions.Add(new UpdateFullTextAction());
job.MachineAffinity = true;
job.MachineName = "MEDIASRV";
job.Save();
To execute these jobs, simply run the RunMaintenanceJobs command on this server. ADAM will
automatically ensure that only the correct server executes this job.
- Site Affinity: ADAM 4.5 goes one step further. Now you can also limit the
execution of a maintenance job to a specific ADAM Site. This enables you to
limit the execution of a maintenance job to any EMEA server or any US server for
example.
RecordMaintenanceJob job = new RecordMaintenanceJob(app);
job.AddNew();
job.Targets.Add(new RecordMaintenanceTarget(someRecordId));
job.Actions.Add(new UpdateFullTextAction());
job.SiteId = theUSSiteId;
job.Save();
By default, RunMaintenanceJobs executes any jobs that don't
have any site affinity specified or that are assigned to the site
RunMaintenanceJobs is executed on. By specifying the -siteOnly argument,
RunMaintenanceJobs only executes the maintenance jobs that have site affinity set to this site.
For example:
Adam.Core.CommandLine RunMaintenanceJobs -siteOnly