Comments (4)
Thanks @edward-yuen-tfs for the level of detail + working repro - I can indeed reproduce the issue.
from elsa-core.
Confirmed on all points 👍🏻
from elsa-core.
I figured out what the problem is. Actually, there are two issues:
1. Variable Persistence
Notice the following line in your workflow:
![image](https://private-user-images.githubusercontent.com/938393/337753891-99934ab7-bfe7-4702-b922-54cc9667a5a3.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MTgyMTUzNjcsIm5iZiI6MTcxODIxNTA2NywicGF0aCI6Ii85MzgzOTMvMzM3NzUzODkxLTk5OTM0YWI3LWJmZTctNDcwMi1iOTIyLTU0Y2M5NjY3YTVhMy5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjQwNjEyJTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI0MDYxMlQxNzU3NDdaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT1jMjAxMjJmOGIzMjVhOTk0NmY0Yzg3ZDMyY2YzZDQ3NjhlYmJkOWM4N2NjOGMzNDg4MzdlNDQyNGQ4MDU5NTAwJlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCZhY3Rvcl9pZD0wJmtleV9pZD0wJnJlcG9faWQ9MCJ9.wChiJ9tuvL5vdoLcDGoX0vnZ8pTVp6qPjOmR4n4quz4)
When using builder.WithVariable()
, it will create a variable on the workflow level.
But when you assign a variable with the same name on a child activity, such as Sequence
in your workflow, that variable becomes closer to your custom activity, which means that your custom activity will be setting the variable's value in the scope of the Sequence
activity and not in the scope of the workflow.
That on its own wouldn't be a big deal, if it weren't for the fact that as of this writing, only workflow-level variables are persisted.
Given that the workflow level variable is never updated, it explains that its value is lost after resuming the workflow instance.
So, if you remove that line that I enrectangled red in the screenshot, it will work - almost.
2. Variable Scoping Bug
While troubleshooting this issue, I encountered a bug that causes your workflow to print the same number twice (the number 4, as you will see).
This is due to a scoping inconsistency bug in Elsa. I am already working on a fix that I will push out over the weekend, which means that you'll be able to take advantage by referencing the preview packages once they are built.
I'll update progress here soon.
from elsa-core.
Thank you for looking into that. Just want to be confirm on this.
- "only workflow-level variables are persisted." - that means
a. activity level variables are not persisted.
b. For the picture below, which I have commented out the line you suggest.
- As I already set the value in the orange box, I do not need to set the value in the red box. Both lines in fact refer to the same scope.
- I do not need the commented line as it shall be considered as defining a new variable within the sequence scope. It is not considered as passing the workflow scope variable to the sequence scope (it is not needed.)
c. After I commented the line, CustomActivity is actually setting the variable value to the workflow scope.
Just want to confirm if my understanding is correct.
from elsa-core.
Related Issues (20)
- [BUG] Workflow Import ID Discrepancy HOT 2
- [BUG] How activity retrieve variable within published workflow HOT 1
- [CHORE] Elsa 3.0在设计器中如何使用Switch(flow)? HOT 1
- [BUG]curl 如何调用在Elsa 3.0设计器中的创建的工作流? HOT 1
- Expired messages in Workflow Inbox should be ignored HOT 2
- [BUG] There is a BUG when Api project cooperates with swagger. HOT 1
- [ENH] Readonly Workflow Variables HOT 1
- [BUG] Issues with POST and GET Execute APIs HOT 1
- [ENH] MongoDB storage for alterations HOT 4
- [FEAT] Postgresql adapter for Hangfire
- [ENH] Optimize Workflow Import by Storing Raw JSON to Avoid Unnecessary Serialization
- [ENH] Enable and Disable MassTransit Consumers HOT 1
- Third-Party Integration Activities HOT 1
- [CHORE] Configure CI/CD with Renovate Bot HOT 1
- Make `Newtonsoft.Json` private? HOT 1
- What is the best place to implement clean-up logic for ActivityExecutionContext HOT 1
- ELSA 3.1.3 Getting Error when i call get /workflow-definitions endpoint HOT 2
- [BUG] MassTransit DisableConsumers Fails to Properly Disable Consumers and Disables Necessary Consumers HOT 1
- [CHORE] Elsa 3.0 设计器中 Fork的属性Branches如何设置? HOT 1
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.