2022-03-15 12:00:48 +00:00
|
|
|
using System.Text.Json.Serialization;
|
2022-01-13 21:38:01 +00:00
|
|
|
using System.Threading.Tasks;
|
2022-01-18 19:28:48 +00:00
|
|
|
using Elsa.Models;
|
2022-01-14 21:39:36 +00:00
|
|
|
using Elsa.Runtime.Contracts;
|
|
|
|
|
using Elsa.Runtime.Models;
|
2022-03-07 21:56:16 +00:00
|
|
|
using Elsa.Jobs.Contracts;
|
2022-03-15 12:00:48 +00:00
|
|
|
using Elsa.Jobs.Models;
|
2022-01-13 21:38:01 +00:00
|
|
|
|
2022-02-01 19:45:11 +00:00
|
|
|
namespace Elsa.Modules.Scheduling.Jobs;
|
2022-01-13 21:38:01 +00:00
|
|
|
|
2022-03-15 12:00:48 +00:00
|
|
|
public class ResumeWorkflowJob : Job
|
2022-01-13 21:38:01 +00:00
|
|
|
{
|
2022-03-15 12:00:48 +00:00
|
|
|
[JsonConstructor]
|
|
|
|
|
public ResumeWorkflowJob()
|
|
|
|
|
{
|
|
|
|
|
}
|
2022-01-14 21:39:36 +00:00
|
|
|
|
2022-03-15 12:00:48 +00:00
|
|
|
public ResumeWorkflowJob(string workflowInstanceId, Bookmark bookmark)
|
|
|
|
|
{
|
|
|
|
|
WorkflowInstanceId = workflowInstanceId;
|
|
|
|
|
Bookmark = bookmark;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public string WorkflowInstanceId { get; set; } = default!;
|
|
|
|
|
public Bookmark Bookmark { get; set; } = default!;
|
2022-01-13 21:38:01 +00:00
|
|
|
|
2022-03-15 12:00:48 +00:00
|
|
|
protected override async ValueTask ExecuteAsync(JobExecutionContext context)
|
2022-01-13 21:38:01 +00:00
|
|
|
{
|
2022-03-15 12:00:48 +00:00
|
|
|
var request = new DispatchWorkflowInstanceRequest(WorkflowInstanceId, Bookmark);
|
|
|
|
|
var workflowInvoker = context.GetRequiredService<IWorkflowInvoker>();
|
|
|
|
|
await workflowInvoker.DispatchAsync(request, context.Cancellation);
|
2022-01-13 21:38:01 +00:00
|
|
|
}
|
|
|
|
|
}
|