Table of Contents

Class JobApi

Namespace: Casewhere.Runtime.DSL.Api
Assembly: Casewhere.Runtime.dll

public class JobApi : IJobApi, IDslApi

Inheritance

objectJobApi

Implements

IJobApi, IDslApi

Inherited Members

object.ToString(), object.Equals(object), object.Equals(object, object), object.ReferenceEquals(object, object), object.GetHashCode(), object.GetType(), object.MemberwiseClone()

Extension Methods

ObjectExtension.ConvertToBsonValue(object), EnumExtensions.DeepClone<JobApi>(JobApi)

Constructors

JobApi(IRuntimeSchedulerService, RuntimeSchedulerValidationService, IRuntimeSchedulerRepository)

public JobApi(IRuntimeSchedulerService runtimeSchedulerService, RuntimeSchedulerValidationService validationService, IRuntimeSchedulerRepository runtimeSchedulerRepository)

Parameters

runtimeSchedulerService IRuntimeSchedulerService

validationService RuntimeSchedulerValidationService

runtimeSchedulerRepository IRuntimeSchedulerRepository

Methods

Add(JobInfo, JobSchedule)

Create a job scheduler for running workflow by schedule time and return the id of job if success

public string Add(JobInfo job, JobSchedule schedule)

Parameters

job JobInfo

The TriggerWorkflowJobInfo

schedule JobSchedule

The JobSchedule

Returns

string

Examples

var jobApi = ctx.Use<IJobApi>();
var jobInfo = new TriggerWorkflowJobInfo(){
    WorkflowDefinitionName="WorkflowDefinitionName",
    ProcessDefinitionName="ProcessDefinitionName",
    Priority=Casewhere.Models.QueuePriority.Normal
};
var schedule = new MinutelyJobSchedule 
{
    Recurrence = 10,
    AllDay=true
});
var jobId = jobApi.Add(jobInfo, schedule);

Delete(string)

Delete the existing Job Information

public void Delete(string id)

Parameters

id string

The Job Id

Examples

var jobApi = ctx.Use<IJobApi>();
var jobId = "theJobId";
jobApi.Delete(jobId, schedule);

GetJobSchedulers()

Get list runtime job schedulers

public IList<RuntimeScheduler> GetJobSchedulers()

Returns

IList<RuntimeScheduler>

UpdateJobInfo(string, JobInfo)

Update the existing job scheduler with the new workflow info

public void UpdateJobInfo(string id, JobInfo job)

Parameters

id string

The Job Id

job JobInfo

The TriggerWorkflowJobInfo

Examples

var jobApi = ctx.Use<IJobApi>();
var jobId = "theJobId";
var jobInfo = new TriggerWorkflowJobInfo(){
    WorkflowDefinitionName="NewWorkflowDefinitionName",
    Priority=Casewhere.Models.QueuePriority.Normal
};
jobApi.UpdateJobInfo(jobId, jobInfo);

UpdateSchedule(string, JobSchedule)

Update the existing job scheduler with the new scheduler

public void UpdateSchedule(string id, JobSchedule schedule)

Parameters

id string

The Job Id

schedule JobSchedule

The Job Schedule

Examples

var jobApi = ctx.Use<IJobApi>();
var jobId = "theJobId";
var schedule = new MinutelyJobSchedule 
{
    Recurrence = 10,
    AllDay=true
});
jobApi.UpdateSchedule(jobId, schedule);