Importing flow definitions from NiFi

If you want to use a NiFi flow in Cloudera DataFlow, you must import it as a flow definition. When imported, the flow definition is added to the flow Catalog.

Importing using the webUI

Learn about importing a flow definition developed in NiFi using the CDF webUI.

  • Create a data flow in NiFi and download it as a flow definition JSON file. For more information, see Creating a Flow Definition.
  • Make sure that you have DFCatalogAdmin permission to perform this task. For information on account and resource roles, see DataFlow Authorization.
  1. Open Cloudera DataFlow by clicking the DataFlow tile in the CDP sidebar.
  2. Click Catalog from the left navigation pane.

    The Flow Catalog page is displayed. Previously imported flow definitions are displayed, one definition per row.

  3. Click Import Flow Definition.
  4. Provide a name (Flow Name) and a description (Flow Description) for the flow definition.
  5. In the NiFi Flow Configuration field, select the JSON file you downloaded from NiFi.

    Alternatively, you can drop the JSON file into this field to select it.

  6. Optional: You can add comments to the flow definition version you are importing (Version Comments).
  7. Optional: You can add custom tags to the flow definition version you are importing (Custom Tag).
  8. Click Import.

You have successfully imported your NiFi flow to Cloudera DataFlow. It is available in the Flow Catalog as the first version of your flow definition.

Deploy the flow definition to an environment. For more information, see Deploying Flows.

Importing using the CLI

Learn about importing a flow definition developed in NiFi using the CDP CLI.

  • Create a data flow in NiFi and download it as a flow definition JSON file. For more information, see Creating a Flow Definition.
  • Make sure that you have DFCatalogAdmin permission to perform this task. For information on account and resource roles, see DataFlow Authorization.
  • You have installed the CDP CLI
To import a flow definition, enter:
cdp df import-flow-definition 
--file [***FILE***] 
--name [***NAME***] 
[--description [***DESCRIPTION***]] 
[--comments [***COMMENTS***]]

Where:

  • --file specifies the path to the flow definition file you want to import.
  • --name is a distinct name for your flow definition.
  • --description is a short description you can use to help identify the flow definition within the DataFlow Catalog.
  • --comments optionally includes any additional information for your flow definition.

Successfully importing a new flow definition results in output similar to:

cdpcli % ./cdp.sh --profile priv df import-flow-definition --file /Users/user1/Downloads/test-flow.json --name EmptyRelName
{
    "crn": "crn:cdp:df:us-west-1:9d74eee4-1cad-45d7-b645-7ccf9edbb73d:flow:EmptyRelName",
    "name": "EmptyRelName",
    "versionCount": 1,
    "createdTimestamp": 1632782902156,
    "modifiedTimestamp": 1632782902156,
    "versions": [
        {
            "crn": "crn:cdp:df:us-west-1:9d74eee4-1cad-45d7-b645-7ccf9edbb73d:flow:EmptyRelName/v.1",
            "bucketIdentifier": "https://s3.us-west-2.amazonaws.com/dfx-flow-artifacts.mow-priv.mow-dev.cloudera.com/dswift/9d74eee4-1cad-45d7-b645-7ccf9edbb73d/18b3b7aa-da62-49a9-bf23-61da8b7a36dc",
            "author": "David Swift",
            "version": 1,
            "timestamp": 1632782902170,
            "deploymentCount": 0
        }
    ]
}

Deploy the flow definition to an environment. For more information, see Deploying Flows.