Nitin Jaiswal
Nitin Jaiswal

Reputation: 1

How to write controller service in nipyapi?

# -*- coding: utf-8 -*-
"""
Created on Mon Oct 12 16:42:29 2020

@author: nitin.jaiswal
"""

import nipyapi
import requests
import json
nipyapi.config.nifi_config.host = 'http://localhost:8080/nifi/'
nipyapi.canvas.get_controller('DistributedMapCacheClientService', 
                              identifier_type='name', bool_response=False)
#Enable Controler
headers = {'Content-Type': 'application/json'}
url = 'http://localhost:8080/nifi-api/flow/process-groups/'+nipyapi.canvas.get_root_pg_id()+'/controller-services'
r = requests.get(url)
reponse = json.loads(r.text)

controllerId = reponse['controllerServices'][0]['id']

nipyapi.canvas.schedule_controller(controllerId, 'True', refresh=False)

I have written this for making process automation but i dont know why controller service is not working

Upvotes: 0

Views: 245

Answers (1)

Mike Thomsen
Mike Thomsen

Reputation: 37524

You can't write NiFi components in Python. All components must be developed in a JVM language (Java, Kotlin, Groovy, Scala, etc.). Also, Nipyapi is meant to be a client API for helping you write your own administrative functions and things like that against NiFi.

Upvotes: 0

Related Questions