Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide ability to utlitize Flow Variables globally #257

Closed
nrichardson99 opened this issue Mar 4, 2016 · 2 comments
Closed

Provide ability to utlitize Flow Variables globally #257

nrichardson99 opened this issue Mar 4, 2016 · 2 comments
Milestone

Comments

@nrichardson99
Copy link
Contributor

Since Flow Parameters are immutable, would be nice to provide a way to create, use and update global variables within a flow.

@gwilmer
Copy link
Contributor

gwilmer commented Jun 19, 2018

This keeps coming up in complex flows. I have a flow now that would benefit greatly from having the ability to set or stamp flow variables that can be used by other components (specifically a bearer token that needs to be used by several web service callers throughout a flow). In a simple flow, it isn't bad to simply pass the variable along in message headers from component to component. However, there are still components that don't pass along message headers (like Temp RDBMS component) as they receive many messages inbound and create a completely different set of messages outbound. The passing along of message headers in these situations becomes confusing, and not sure it's the right thing to do.

I think we need to be able to have all component runtimes have the ability to read/write from a set of global flow variables. They would need to be synchronized as threading would def. be an issue. I think we should be able to:

  • read / write from these variables in the script component
  • possibly allow the stamp component to write to these variables (i.e. select whether you want to stamp something in the message header or in the flow variables)
  • allow all components variable substitution to utilize these flow variables. (this would make something like a bearer token used by multiple web service callers very simple as we could use flow variables in the http header).

@gwilmer
Copy link
Contributor

gwilmer commented Jun 21, 2018

ComponentContext now has access to a synchronized map in FlowRuntime called flowVariables. flowParameters are still immutable. flowVariables can be set and read by different components in the flow. From script component:

context.flowVariables.put(key,value) and
context.flowVariables.get(key)

variable replacement through AbstractComponentRuntime.resolveParamsAndHeaders now includes flowVariables as well.

Will update stamp component in a different issue.

@gwilmer gwilmer added this to the 3.2.0 milestone Jun 21, 2018
gwilmer pushed a commit that referenced this issue Jul 11, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants