본문으로 바로가기

Make Custom Processors

category OSS/NiFi 2019. 4. 15. 11:31

Java Project Structure

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
root
┣━━ custom-processors-bundle
┃    ┣━━ example1-bundle
┃    ┃     ┣━━ example1-processors
┃    ┃     ┃     ┗━━ src
┃    ┃     ┃           ┣━━ main
┃    ┃     ┃           ┃     ┣━━ processor1.java
┃    ┃     ┃           ┃     ┗━━ processor2.java
┃    ┃     ┃           ┗━━ resource
┃    ┃     ┃                  ┗━━ META-INF
┃    ┃     ┃                        ┗━━ services
┃    ┃     ┃                              ┗━━ org.apache.nifi.processor.Processor
┃    ┃     ┗━━ example1-processors-nar
┃    ┃            ┗━━ target
┃    ┃                  ┗━━ .nar
┃    ┗━━ example2-bundle
┃           ┗━━ ...
┗━━ custom-services-bundle
      ┣━━ example1-services-bundle
      ┃     ┣━━ example1-services
      ┃     ┃    ┗━━ .java
      ┃     ┗━━ example1-services-nar
      ┃           ┗━━ .nar
      ┗━━ example2-services-bundle
             ┗━━ ...

 

custom-processors-bundle: 새롭게 만들 프로세서들

custom-services-bundle: 새롭게 만들 서비스들

 

각 NAR 는 하나의 NAR 종속성만 가질 수 있다.

일반적으로 Controller Service API 와 함께 패키징하거나 체인을 설정함.

 

Dependency Chain for Services (NAR dependencies)

  • example1-services-nar -> example1-service-api-nar -> nifi-standard-services-api-nar

Dependency Chain for Processors (NAR dependencies)

  • example1-processors-nar -> example1-service-api-nar

참고: https://github.com/bbende/nifi-dependency-example

 

Make HDFS Custom Processors Example

기존 GetHDFS -> WriteHDFS 수정

properties 에 core-site.xml 이 필요한 것을 hdfs url, user 입력으로 치환

 

UserGroupInformation 사용

 

Dependency Chain

  • nifi-custom-hdfs-processors (.jar) -> nifi-custom-hdfs-processors-nar -> nifi-standard-services-api-nar 

 

NiFi version: 1.3

 

ex source: https://github.com/cukuzz/nifi-custom-hdfs-processors-example

 

 

'OSS > NiFi' 카테고리의 다른 글

Apache NiFi Install  (0) 2019.04.15