Support Questions

Find answers, ask questions, and share your expertise

Command Line Arguments Run Template

avatar
Explorer

I created a template to convert data from querying Postgres database and then convert it into xml. I want to run it by using command line arguments. Are there any way to do this in NiFi?

 

Thank you

1 ACCEPTED SOLUTION

avatar
Master Mentor

@FrankHaha 

I am a little confused on your ask due to the terminology used.

A NiFi template (deprecated and removed in NiFi 2.x) is a reusable NiFi dataflow snippet (collection of interconnected components and controller services in XML format).  Templates have been replaced by "flow definitions" (similar to templates but in json format). You can't execute a template or a flow definition.  You can deploy a template or flow definition to the canvas of an installed and running NiFi instance.  

Anything you can do via the NiFi UI, you can also accomplish via NiFi rest-api calls.  The easiest way to learn what rest-api calls are needed and the format of each of those rest-api calls is through the use of yoru browsers built-in developer tools.  You can perform each action via the UI and "capture as curl" through the browser developers tools "network" tab the rest-api call that was made.  This includes importing a flow definition or template, modifying components imported, enabling, starting, stopping, etc)  You can put those calls into a script to perform those same commands later without using the UI.

Another option might be through the use of the NiFi CLI toolkit which offers a variety of commands for doing similar functions as the rest-api calls.

If you found any of the suggestions/solutions provided helped you with your issue, please take a moment to login and click "Accept as Solution" on one or more of them that helped.

Thank you,
Matt

View solution in original post

1 REPLY 1

avatar
Master Mentor

@FrankHaha 

I am a little confused on your ask due to the terminology used.

A NiFi template (deprecated and removed in NiFi 2.x) is a reusable NiFi dataflow snippet (collection of interconnected components and controller services in XML format).  Templates have been replaced by "flow definitions" (similar to templates but in json format). You can't execute a template or a flow definition.  You can deploy a template or flow definition to the canvas of an installed and running NiFi instance.  

Anything you can do via the NiFi UI, you can also accomplish via NiFi rest-api calls.  The easiest way to learn what rest-api calls are needed and the format of each of those rest-api calls is through the use of yoru browsers built-in developer tools.  You can perform each action via the UI and "capture as curl" through the browser developers tools "network" tab the rest-api call that was made.  This includes importing a flow definition or template, modifying components imported, enabling, starting, stopping, etc)  You can put those calls into a script to perform those same commands later without using the UI.

Another option might be through the use of the NiFi CLI toolkit which offers a variety of commands for doing similar functions as the rest-api calls.

If you found any of the suggestions/solutions provided helped you with your issue, please take a moment to login and click "Accept as Solution" on one or more of them that helped.

Thank you,
Matt