From 54f6d27082a3c1c105bef2bf35b7fd7b55040e17 Mon Sep 17 00:00:00 2001 From: Sipke Schoorstra Date: Mon, 4 Nov 2024 11:05:18 +0100 Subject: [PATCH] Add method to resume bookmark with ID and input dictionary This commit introduces a new method in both `BookmarkResumer` and `IBookmarkResumer` to resume a bookmark using a bookmark ID and an input dictionary. This enhancement allows more flexibility in resuming bookmarks with varying input parameters. --- .../Contracts/IBookmarkResumer.cs | 3 +++ .../Services/BookmarkResumer.cs | 16 +++++++++++++++- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/src/modules/Elsa.Workflows.Runtime/Contracts/IBookmarkResumer.cs b/src/modules/Elsa.Workflows.Runtime/Contracts/IBookmarkResumer.cs index b219ebf91..25ee4af00 100644 --- a/src/modules/Elsa.Workflows.Runtime/Contracts/IBookmarkResumer.cs +++ b/src/modules/Elsa.Workflows.Runtime/Contracts/IBookmarkResumer.cs @@ -8,6 +8,9 @@ public interface IBookmarkResumer { /// Resumes the bookmark. Task ResumeAsync(object stimulus, ResumeBookmarkOptions? options = null, CancellationToken cancellationToken = default) where TActivity : IActivity; + + /// Resumes the bookmark. + Task ResumeAsync(string bookmarkId, IDictionary input, CancellationToken cancellationToken = default); /// Resumes the bookmark. Task ResumeAsync(object stimulus, string? workflowInstanceId, ResumeBookmarkOptions? options = null, CancellationToken cancellationToken = default) where TActivity : IActivity; diff --git a/src/modules/Elsa.Workflows.Runtime/Services/BookmarkResumer.cs b/src/modules/Elsa.Workflows.Runtime/Services/BookmarkResumer.cs index aee17779e..519b9ef1c 100644 --- a/src/modules/Elsa.Workflows.Runtime/Services/BookmarkResumer.cs +++ b/src/modules/Elsa.Workflows.Runtime/Services/BookmarkResumer.cs @@ -28,7 +28,21 @@ public class BookmarkResumer(IWorkflowRuntime workflowRuntime, IBookmarkStore bo }; return await ResumeAsync(bookmarkFilter, options, cancellationToken); } - + + /// + public async Task ResumeAsync(string bookmarkId, IDictionary input, CancellationToken cancellationToken = default) + { + var bookmarkFilter = new BookmarkFilter + { + BookmarkId = bookmarkId + }; + var options = new ResumeBookmarkOptions + { + Input = input + }; + return await ResumeAsync(bookmarkFilter, options, cancellationToken); + } + /// public async Task ResumeAsync(string bookmarkId, ResumeBookmarkOptions? options = null, CancellationToken cancellationToken = default) where TActivity : IActivity {