What is the best place to implement clean-up logic for ActivityExecutionContext #5701
Replies: 2 comments
-
In Elsa Workflow, there isn't a built-in mechanism for centralized disposal of objects stored in the Here are a few approaches you could consider:
Remember that the best approach will depend on the specifics of your application and workflows. If you need to dispose of resources at specific points in the workflow, you may need to ensure that your cleanup logic is invoked at those points, which could mean adding cleanup activities to your flowchart branches. This comment was generated by Glime. |
Beta Was this translation helpful? Give feedback.
-
To implement custom disposal logic for objects stored as variables on the Elsa workflows do not inherently provide a built-in disposal mechanism for objects stored in the execution context. Therefore, you would need to handle the disposal manually. Here are a couple of approaches you could take:
Remember that the chosen approach should fit your application's architecture and workflow design. If you find that you frequently need to dispose of objects, it might be worth considering if there's a way to reduce the need for disposable objects in your workflows or to manage their lifecycle more effectively outside of the workflow context. This comment was generated by Glime. |
Beta Was this translation helpful? Give feedback.
-
In our application we mostly build workflows which use the Flowchart class. Our own activities mostly derive from the CodeActivity class.
To share data between activities we use the ActivityExecutionContext object (input parameter for ExecuteAsync(...))
Now I wonder what would be the best approach to do some custom disposal logic for objects that are stored as variables on the ActivityExecutionContext. The workflows itself have various connections and different activities and outcomes. I could add some kind of CleanUpActivity to every branch of the execution tree, but I hope that a more simple/centralized approach is possible?
Beta Was this translation helpful? Give feedback.
All reactions