Skip to content

NiFi Template Inspector

Andrew Grande edited this page Apr 28, 2016 · 5 revisions

NiFi Template Inspector

  • Quickly inspect any template (can point to remote URIs as well, not only local files)
  • Generates a YAML output which can be used with the `NiFiDeploy.groovy' next
  • A user need only copy/paste properties she wants changed on deployment (e.g. overriding template settings)

E.g. let's take a look at the Hello NiFi Web Service from the NiFi wiki page: https://cwiki.apache.org/confluence/display/NIFI/Example+Dataflow+Templates

Note how a URI is in quotes due to special characters in it:

♨ >  groovy TemplateInspector.groovy -f 'https://cwiki.apache.org/confluence/download/attachments/57904847/Hello_NiFi_Web_Service.xml?version=1&modificationDate=1449369797000&api=v2'

nifi:
  templateUri: https://cwiki.apache.org/confluence/download/attachments/57904847/Hello_NiFi_Web_Service.xml?version=1&modificationDate=1449369797000&api=v2
  templateName: Hello NiFi Web Service
controllerServices:
  StandardHttpContextMap:
    state: ENABLED
    config:
      Maximum Outstanding Requests: ''
      Request Expiration: ''
processGroups:
  Hello NiFi Web Service:
    processors:
      Receive request and data:
        config:
          Listening Port: '8011'
          Hostname: ''
          SSL Context Service: ''
          HTTP Context Map: ${StandardHttpContextMap}
          Allowed Paths: ''
          Default URL Character Set: ''
          Allow GET: ''
          Allow POST: ''
          Allow PUT: ''
          Allow DELETE: ''
          Allow HEAD: ''
          Allow OPTIONS: ''
          Additional HTTP Methods: ''
          Client Authentication: ''
      Update Request Body with a greeting!:
        config:
          Regular Expression: ''
          Replacement Value: Hello, NiFi!
          Character Set: ''
          Maximum Buffer Size: ''
          Evaluation Mode: ''
      Respond with enriched data:
        config:
          HTTP Status Code: '200'
          HTTP Context Map: ${StandardHttpContextMap}

The output is structured so that a user can quickly copy/paste snippets and override properties for deployment. E.g. here's what the deployment script looks like with an overridden port value for the web service (:

nifi:
  url: http://192.168.99.103:9091
  clientId: Deployment Script v1
  templateUri: "https://cwiki.apache.org/confluence/download/attachments/57904847/Hello_NiFi_Web_Service.xml?version=1&modificationDate=1449369797000&api=v2"
  
# undeploy section omitted from this example

controllerServices:
  StandardHttpContextMap:
    state: ENABLED

processGroups:
  Hello NiFi Web Service:
    processors:
      Receive request and data:
        state: RUNNING
        config:
          Listening Port: 10000
Clone this wiki locally