Comments (2)
-
The behavior you're observing is consistent with the purpose of the
CreateBookmark()
method. When you callcontext.CreateBookmark()
, it indicates a point where the workflow should pause and wait for an external event to resume. If you place aConsole.WriteLine
afterCreateBookmark()
, it will execute immediately because the workflow has not yet been suspended. To suspend the workflow in the middle of an activity, you should ensure thatCreateBookmark()
is the last call in the activity's execution path that should run before pausing. -
Regarding the
RunAsync()
method, it seems there might be a discrepancy between the documentation and the actual API. The documentation you're referring to might be outdated or incorrect. To resume a workflow, you typically need to provide a bookmark ID to theRunAsync()
method. If the overload you're looking for doesn't exist, you may need to use a different method or a different overload ofRunAsync()
that is available in the version of Elsa you are using.
For the most accurate and up-to-date information on how to suspend and resume workflows, I recommend checking the latest official Elsa documentation or the source code directly. If the documentation is indeed outdated, you can open an issue on the Elsa GitHub repository or contact the maintainers to request an update.
For now, you can try using the WorkflowInstanceFilter
to find the workflow instance and then use the RunWorkflowOptions
to specify the bookmark ID when calling RunAsync()
. Here's an example based on the information from the GitHub issues:
var options = new WorkflowInstanceFilter
{
Id = InstanceId,
};
var workflowInstance = await _workflowInstanceStore.FindAsync(options);
var workflowState = workflowInstance.WorkflowState;
var bookmark = workflowState.Bookmarks.FirstOrDefault(b => /* your condition here */);
var runOptions = new RunWorkflowOptions { BookmarkId = bookmark?.Id };
var result = await _workflowRunner.RunAsync(workflow, runOptions);
Please note that the above code is just an example and may need to be adjusted based on the actual API and your specific use case.
This comment was generated by Glime.
from elsa-core.
Right, in that case the first point can be ignored (since it was mostly a question anyway).
The second point still stands and using the RunAsync method like in the example will run the entire workflow, not just resume it.
from elsa-core.
Related Issues (20)
- Could you please help me solve this problem as soon as possible? Thank you! HOT 2
- Read event inputs in next activity? HOT 3
- [BUG] Timer Trigger not respecting SingletoneStrategy HOT 4
- Elsa 3.1 oracle migration support HOT 1
- [BUG] Default CRON causes extremely high memory usage until Out of Memory exception HOT 10
- [ENH] Include dropdown when using a nullable enum in an activity input HOT 2
- [BUG] Race Condition in WorkflowDefinitionActivity Causing Execution Failures HOT 1
- [BUG] ResumeWorkflowAsync at ActivityNodeId losing Input values between activities HOT 3
- Unable to Open Workflow Instance View Screen in Customized Elsa UI HOT 4
- Workflow instance viewer activity badges don't update after resuming workflow for a suspended HttpEndpoint activity HOT 1
- [BUG] InvalidOperationException: No service for type 'Elsa.Api.Client.Resources.Package.Contracts.IPackageApi' has been registered. HOT 2
- Elsa 3.1.3 Http end point using dispatch workflow not waiting for child workflow completion even though 'Wait for completion' set true HOT 1
- Elsa runs the same workflow multiple times with Azure ServiceBus HOT 2
- Can Chinese be supported HOT 1
- [BUG] FlowJoin Activity Throws NullReferenceException Without Previous Forks
- [PERF] Workflow Graph Loading Enhancement HOT 1
- [PERF] Remove Caching Decorator for Bookmarks to Reduce Service Bus Message Load HOT 1
- [FEAT] "ScheduleActivity" to "Completed" activity instance. HOT 1
- [BUG] Serialization error when 'MessageReceived' activity is used in workflow HOT 9
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from elsa-core.