我正在为 Apache NiFi 开发 Milo OPCUA 处理器和服务。 处理器和服务编译正常,我可以用它们启动 NiFi。但是,当尝试为我刚刚添加的处理器配置服务时,它只是说“找不到适用于此属性的 Controller 服务类型。”。
这是我的 POM:
处理器 JAR
<parent>
<groupId>com.tcon</groupId>
<artifactId>pubsub</artifactId>
<version>0.1</version>
</parent>
<artifactId>nifi-pubsub-processors</artifactId>
<packaging>jar</packaging>
<dependencies>
<dependency>
<groupId>org.apache.nifi</groupId>
<artifactId>nifi-api</artifactId>
</dependency>
<dependency>
<groupId>org.apache.nifi</groupId>
<artifactId>nifi-utils</artifactId>
</dependency>
<dependency>
<groupId>org.apache.nifi</groupId>
<artifactId>nifi-mock</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>tcon</groupId>
<artifactId>nifi-miloservice-api</artifactId>
<version>0.1</version>
</dependency>
</dependencies>
处理器 NAR
<parent>
<groupId>com.tcon</groupId>
<artifactId>pubsub</artifactId>
<version>0.1</version>
</parent>
<artifactId>nifi-pubsub-nar</artifactId>
<version>0.1</version>
<packaging>nar</packaging>
<properties>
<maven.javadoc.skip>true</maven.javadoc.skip>
<source.skip>true</source.skip>
</properties>
<dependencies>
<dependency>
<groupId>com.tcon</groupId>
<artifactId>nifi-pubsub-processors</artifactId>
<version>0.1</version>
</dependency>
<dependency>
<groupId>org.apache.nifi</groupId>
<artifactId>nifi-standard-services-api-nar</artifactId>
<version>1.2.0</version>
<type>nar</type>
</dependency>
</dependencies>
据我所知,服务 POM 应该无关紧要。它们没有被修改,除了一些 Milo 依赖项。
如您所见,处理器 JAR POM 具有来 self 的自定义服务的自定义服务 API 依赖项,而处理器 NAR POM 具有来自 nifi 的标准 API 依赖项。
文档说这就是我需要做的将我的处理器“链接”到我的服务。
我错过了什么?
最佳答案
您还需要通过在处理器 JAR 项目的 src/main/resources 文件夹中包含一个文件来向 ServiceLoader 注册您的 Controller 服务。您需要在资源文件夹下有一个 META-INF/services 文件夹,其中包含一个名为 org.apache.nifi.controller.ControllerService
的文件,其中一行包含实现 ControllerService 的类的完全限定名称界面。
关于java - NIFI : No controller service types found that are applicable for this property,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51636730/