Table of Contents

Interface IJobApi

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

Provides methods for managing a job scheduler to trigger a workflow.

public interface IJobApi : IDslApi

Implements

IDslApi

Extension Methods

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

Methods

Add(JobInfo, JobSchedule)

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

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

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

IList<RuntimeScheduler> GetJobSchedulers()

Returns

IList<RuntimeScheduler>

UpdateJobInfo(string, JobInfo)

Update the existing job scheduler with the new workflow info

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

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);