Support Questions

Find answers, ask questions, and share your expertise

Apache Nifi - How do I change a value of a window variable during my workflow?

avatar

Apache Nifi - How do I change a value of a window variable during a workflow? Which processor should I use? What syntax?

3 REPLIES 3

avatar
Master Guru

What do you mean by "window variable"? Do you mean a Process Group Variable? If so, you can change it via the UI or REST API (I believe the endpoint is /nifi-api/process-groups/<id>/variable-registry/update-requests). Note that it will stop any affected processors or controller services, then change the variable value, then restart/re-enable the affected components.

If you mean a Flow File attribute, you can add/change/delete those using the UpdateAttribute processor.

avatar

Matt, I mean a group variable. In my flow, I need to save the value of an attribute at the beginning of the stream to reuse it from the middle of the stream in processor ReplaceText, after a GetMongo processor, however, after I create the variable I can not update the value of that variable. I also tried to save the content of this attribute in state value, however, I can not retrieve it later. Look at this example in the attached image. Thank you!

95410-example.png

avatar
New Contributor

You cannot share states between processor, each processor has it's own state.