How to handle results of Actions in states such as OperationState #485
-
In the specs, several states (e.g. Operation) allows an array of actions to be performed but does not (i think) say anything about how to handle the returned array of responses (i assume one for each action). How would i treat this array of responses? B. Do not merge the array of responses, Thanks |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 4 replies
-
Have a look at this sample, https://github.com/serverlessworkflow/specification/blob/main/specification.md#using-multiple-data-filters. Each Function/Operation can specify a toStateData filter. This is not an answer to your question, but may give bit more clarity for what you are looking |
Beta Was this translation helpful? Give feedback.
-
@globalflea to add to @manick02 response, there is a number of questions here so will address them individually:
Actions array defines functions (actions) that need to be invoked during workflow execution As soon as the action (function invocation) completes, and has a result, it should be merged into states data. So if you have a sequential actionMode, and 2 action definitions inside the actions array you should have the following sequence:
In case of parallel actionMode, its similar except it happens as soon as the parallel action invocation produces a result, until all parallel function invocations are completed. By default, each actions "data input" is the current state data (state data right before the action/function is scheduled to be in invoked. You can have control over this default behavior with action data filers. Action data filers are per-action so you have to currently define them for each of your actions. I think it would be good to add a default action data filer for all actions (please raise an issue for this :)) Let's look how action data filers come into play:
Hope this helps. Now from this i see three improvements we can do in the spec, please open issues for those in the spec repo:
|
Beta Was this translation helpful? Give feedback.
-
A. Answered in previous post, for sequential invocations its done one after the other, for parallel, as soon as one action completes |
Beta Was this translation helpful? Give feedback.
-
B. Yes there is currently no way to specify that (see earlier reply to raise an issue in the spec repo for that). Currently its assumed if action/function has no results then there is nothing to be merged, but thats not enough. |
Beta Was this translation helpful? Give feedback.
B. Yes there is currently no way to specify that (see earlier reply to raise an issue in the spec repo for that). Currently its assumed if action/function has no results then there is nothing to be merged, but thats not enough.
B.1, B.1.a. Believe answered in previ…