NIFI templates in template folder in sync with templates inside NIFI UI

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

NIFI templates in template folder in sync with templates inside NIFI UI

尹文才
Hi guys, I put all my flow template xml files inside the nifi template
directory specified inside the nifi.properties config file so that nifi
could read in all my templates. But sometimes I need to clear all the
templates currently inside nifi and then place in a new template, I would
remove all the template xml files inside the template folder and put the
new template xml file into it. But when I restart nifi, there're 5
templates available, which are 4 old templates and 1 new template.

I know I could manually remove all templates inside nifi, but I wish to do
this all programmatically. I also know nifi keeps the templates inside the
flow.xml.gz file.
So does nifi simply adds the new templates in the template folder into the
flow.xml.gz file without removing the old ones?

I have used beyond compare trying to compare the template xml file content
with the template section inside the flow.xml extracted from flow.xml.gz,
they're slightly differently and most content are the same, does anyone
know the relationship between these two?

What I want to achieve is to keep the templates in the template folder and
the templates in nifi in sync without having to manually  do anything in
nifi UI, does
anyone know if it's possible and if so how? Thanks.

/Ben
Reply | Threaded
Open this post in threaded view
|

Re: NIFI templates in template folder in sync with templates inside NIFI UI

Matt Gilman
Ben,

In the 0.x baseline, the templates were stored in the templates directory
that you're referring to. Starting in the 1.x baseline, the templates were
migrated to become part of the flow.xml.gz. In order to support users
upgrading from 0.x to 1.x, templates in the directory are automatically
moved to the flow.xml.gz. If you're looking to automate template
importing/removal, I would recommend using the REST API. If you open up
your browser you should be able to see these requests in action.
Additionally, you can find documentation for them here [1]. The
import/upload endpoints are under Process Groups and the removal endpoints
are under Templates.

Thanks

Matt

[1] https://nifi.apache.org/docs/nifi-docs/rest-api/index.html

On Thu, Sep 14, 2017 at 2:40 AM, 尹文才 <[hidden email]> wrote:

> Hi guys, I put all my flow template xml files inside the nifi template
> directory specified inside the nifi.properties config file so that nifi
> could read in all my templates. But sometimes I need to clear all the
> templates currently inside nifi and then place in a new template, I would
> remove all the template xml files inside the template folder and put the
> new template xml file into it. But when I restart nifi, there're 5
> templates available, which are 4 old templates and 1 new template.
>
> I know I could manually remove all templates inside nifi, but I wish to do
> this all programmatically. I also know nifi keeps the templates inside the
> flow.xml.gz file.
> So does nifi simply adds the new templates in the template folder into the
> flow.xml.gz file without removing the old ones?
>
> I have used beyond compare trying to compare the template xml file content
> with the template section inside the flow.xml extracted from flow.xml.gz,
> they're slightly differently and most content are the same, does anyone
> know the relationship between these two?
>
> What I want to achieve is to keep the templates in the template folder and
> the templates in nifi in sync without having to manually  do anything in
> nifi UI, does
> anyone know if it's possible and if so how? Thanks.
>
> /Ben
>
Reply | Threaded
Open this post in threaded view
|

Re: NIFI templates in template folder in sync with templates inside NIFI UI

尹文才
Thanks Matt, I could make use of the rest api to automate the template sync
work.😀

2017-09-15 1:00 GMT+08:00 Matt Gilman <[hidden email]>:

> Ben,
>
> In the 0.x baseline, the templates were stored in the templates directory
> that you're referring to. Starting in the 1.x baseline, the templates were
> migrated to become part of the flow.xml.gz. In order to support users
> upgrading from 0.x to 1.x, templates in the directory are automatically
> moved to the flow.xml.gz. If you're looking to automate template
> importing/removal, I would recommend using the REST API. If you open up
> your browser you should be able to see these requests in action.
> Additionally, you can find documentation for them here [1]. The
> import/upload endpoints are under Process Groups and the removal endpoints
> are under Templates.
>
> Thanks
>
> Matt
>
> [1] https://nifi.apache.org/docs/nifi-docs/rest-api/index.html
>
> On Thu, Sep 14, 2017 at 2:40 AM, 尹文才 <[hidden email]> wrote:
>
> > Hi guys, I put all my flow template xml files inside the nifi template
> > directory specified inside the nifi.properties config file so that nifi
> > could read in all my templates. But sometimes I need to clear all the
> > templates currently inside nifi and then place in a new template, I would
> > remove all the template xml files inside the template folder and put the
> > new template xml file into it. But when I restart nifi, there're 5
> > templates available, which are 4 old templates and 1 new template.
> >
> > I know I could manually remove all templates inside nifi, but I wish to
> do
> > this all programmatically. I also know nifi keeps the templates inside
> the
> > flow.xml.gz file.
> > So does nifi simply adds the new templates in the template folder into
> the
> > flow.xml.gz file without removing the old ones?
> >
> > I have used beyond compare trying to compare the template xml file
> content
> > with the template section inside the flow.xml extracted from flow.xml.gz,
> > they're slightly differently and most content are the same, does anyone
> > know the relationship between these two?
> >
> > What I want to achieve is to keep the templates in the template folder
> and
> > the templates in nifi in sync without having to manually  do anything in
> > nifi UI, does
> > anyone know if it's possible and if so how? Thanks.
> >
> > /Ben
> >
>