我创建了一个最小的 python 示例来设置读者服务属性定义:
from nifiapi.properties import PropertyDescriptor
from nifiapi.flowfiletransform import FlowFileTransform, FlowFileTransformResult
class PythonReaderServiceExample(FlowFileTransform):
class Java:
implements = ['org.apache.nifi.python.processor.FlowFileTransform']
class ProcessorDetails:
dependencies = []
version = '0.0.1-SNAPSHOT'
def __init__(self, **kwargs):
self.RECORD_READER = PropertyDescriptor(
name="Record Reader",
description="Specifies the Controller Service to use for parsing incoming data into Records.",
required=True,
allowable_values=["- create new service -"],
controller_service_definition="org.apache.nifi.serialization.RecordReaderFactory")
self.descriptors = [self.RECORD_READER]
def getPropertyDescriptors(self):
return self.descriptors
def transform(self, context, flowFile):
return FlowFileTransformResult(relationship = "success")
我看到创建新读者服务的选项:
当我添加服务时,我看到以下内容:
我的目标是能够设置 Reader Service 并能够导航到它等,按照此 PutAzureCosmosDBRecord 示例:
我的 Python 代码中还需要包含什么?
似乎只需删除 allowed_values 属性定义就足以解决此问题。
allowable_values=["- create new service -"],