danielgerlag / conductor

Distributed workflow server
MIT License
530 stars 98 forks source link

Passing data between steps? #26

Closed StefanS998 closed 1 year ago

StefanS998 commented 4 years ago

Hi, I'm beginner and I'd like to ask a question. Whether there is a way to send data from one step to another? For example, in one step I do HttpRequest and I get JSON record. I want to pass JSON data to next step, and do some kind of data manipulation inside workflow, without REST service. Is this possible? Gratefully, Stefan

OluAgunloye commented 4 years ago

I second this, although I wouldn't use the http request example as ResponseCode:step.ResponseCode and ResponseBody:step.ResponseBody take care of piping outputs.

What about a situation where I have multiple Activities? How do I uniquely log the Activity results for later retrieval?

What about custom data inputs, how do I reference them without assigning a new variable name to each custom input?

How do I assign them as the output of any given step for reuse in later steps?

We may need some sort of binding structure here where all custom data inputs are enumerated and/or indexed and that object is referencable with a few methods. Something like a dict or JSON object.

On Thu, Aug 13, 2020, 1:14 PM StefanS998 notifications@github.com wrote:

Hi, I'm beginner and I'd like to ask a question. Whether there is a way to send data from one step to another? For example, in one step I do HttpRequest and I get JSON record. I want to pass JSON data to next step, and do some kind of data manipulation inside workflow, without REST service. Is this possible? Gratefully, Stefan

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/danielgerlag/conductor/issues/26, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABSPVKVU7A7OBC7E5WFQBFTSAQUO5ANCNFSM4P6WWGEA .

OluAgunloye commented 4 years ago

Bumping this. @danielgerlag Are we missing something here?

danielgerlag commented 4 years ago

You can map the outputs of any step to fields on the data context of your workflow instance, and then map those fields back into inputs of other steps. see https://conductor-core.readthedocs.io/en/latest/primitives/

OluAgunloye commented 4 years ago

@danielgerlag So I don't have to use "ActivityResult" as the field name? I think I've tried this and other fields didn't work so I assumed it was a reserved name. In any case, let me try again because that would indeed be very helpful. Thanks again for your help!

OluAgunloye commented 4 years ago

@StefanS998 Close this when you get the chance, Daniel's answer is correct. You just change the key name from its default (i.e. ActivityResult or EventData) to something without a decimal/period (or you'll run into BSON Serialization Errors).