Work with templates

Templates in the NiFi Server interface are used when it is necessary to create several typical identical sections in a large flow scheme. Using a template, it is possible to group basic components created with toolbar.

Manage templates

Templates are managed in the Templates window, which opens when you click the menu item of the same name in the global menu of the NiFi Server interface window. This window contains all the templates that can be used in this instance of NiFi.

Possible actions on templates in the Templates window:

  • filter templates by name or description;

  • export a template as an XML file;

  • delete a template.

nifi templ 04 dark
The Templates window in the global menu
nifi templ 04 light
The Templates window in the global menu

There are two ways to add a template to the list of templates:

  • create a template in the current instance of NiFi;

  • import a template as an XML file exported in another NiFi instance.

Create a template

The template is created in the following sequence:

  1. On the canvas, select the сomponents that should be part of the template. Multiple items can be selected by holding down the Shift key.

    nifi templ 01 dark
    Selected сomponents
    nifi templ 01 light
    Selected сomponents
  2. Click the icon nifi ui oper 06 on the Action Palette or the Create Template item in the context menu called by the right mouse button.

  3. In the window that opens, enter the name of the template and, if necessary, its description.

    nifi templ 02 dark
    Create a template
    nifi templ 02 light
    Create a template
  4. Click CREATE and get a message about the successful creation of the template.

    nifi templ 03 dark
    The template is created
    nifi templ 03 light
    The template is created

    After being created, the template appears in the list in the Templates window.

NOTE

If you start creating a template by clicking an empty area in the canvas (inside the process group) without selecting сomponents, the template will contain all the сomponents of the current process group (present on this canvas).

Export the created template as an XML file

After the template appears in the list of the Templates window, it is possible to save this template as an XML file. To do this, in the line with the selected template, click the icon nifi ui oper 06. After loading the <template_name>.xml file, you can view its XML representation.

nifi templ 05 dark
Template as an XML file
nifi templ 05 light
Template as an XML file

Import template

A template saved as an XML file can be imported into any NiFi process group where the user has the appropriate permissions.

The template is imported in the following sequence:

  1. Click the icon nifi operate 7 2 on Action Palette or the Upload Template item in the context menu called by the right mouse button.

  2. In the window that opens, click the icon search.

    nifi templ 06 dark
    Load a template
    nifi templ 06 light
    Load a template
  3. Select a template and click Select.

    nifi templ 07 dark
    Select a template
    nifi templ 07 light
    Select a template
  4. Make sure the correct template is selected and click UPLOAD.

    nifi templ 08 dark
    Load the template
    nifi templ 08 light
    Load the template
  5. Receive a message about the successful loading of the template.

    nifi templ 09 dark
    The template is loaded
    nifi templ 09 light
    The template is loaded

After import, the template appears in the Templates window list.

Use a template

After being created or imported, the template is ready to be used on the canvas.

Creating a group of сomponents on the canvas using a template is performed in the following sequence:

  1. Move icon nifi ui templ dark nifi ui templ light from the toolbar to the canvas.

    nifi templ 11 dark
    Create a group of сomponents using a template
    nifi templ 11 light
    Create a group of сomponents using a template
  2. In the window that opens, select a template from the list.

    nifi templ 10 dark
    Select a template from the list
    nifi templ 10 light
    Select a template from the list
  3. Click ADD.

As a result, a group of сomponents is created on the canvas in accordance with the selected template. The top left part of the template is placed in the same area where the template icon was moved from the toolbar. After being created, the group remains selected to be moved to the right place on the canvas or deleted if necessary.

nifi templ 12 dark
Group of сomponents created from template
nifi templ 12 light
Group of сomponents created from template

Сomponents created using a template are used in the flow in the same way as сomponents created directly from the toolbar.

Found a mistake? Seleсt text and press Ctrl+Enter to report it