Apache Nifi 简明教程

Apache NiFi - Processors Relationship

在 Apache NiFi 数据流中,流文件通过通过处理器之间的关系进行验证的连接从一个处理器移动到另一个处理器。每当建立连接时,开发人员都会选择这些处理器之间的一个人或多个关系。

In an Apache NiFi data flow, flowfiles move from one to another processor through connection that gets validated using a relationship between processors. Whenever a connection is created, a developer selects one or more relationships between those processors.

configure processor

如上图所示,黑框中的复选框就是关系。如果开发人员选中这些复选框,则当关系成功、失败或同时成功和失败时,流文件将在该特定处理器中终止。

As you can see in the above image, the check boxes in black rectangle are relationships. If a developer selects these check boxes then, the flowfile will terminate in that particular processor, when the relationship is success or failure or both.

Success

当处理器成功处理流文件(如从任何数据源存储或获取数据)而没有出现任何连接、身份验证或任何其他错误时,流文件将转到成功关系。

When a processor successfully processes a flowfile like store or fetch data from any datasource without getting any connection, authentication or any other error, then the flowfile goes to success relationship.

Failure

当处理器无法在没有错误(如身份验证错误或连接问题等)的情况下处理流文件时,流文件将转到失败关系。

When a processor is not able to process a flowfile without errors like authentication error or connection problem, etc. then the flowfile goes to a failure relationship.

开发人员还可以使用连接将流文件传输到其他处理器。开发人员可以选择它并进行负载平衡,但负载平衡仅在 1.8 版中发布,本教程中不会介绍。

A developer can also transfer the flowfiles to other processors using connections. The developer can select and also load balance it, but load balancing is just released in version 1.8, which will not be covered in this tutorial.

failure

如上图所示,标有红色的连接具有失败关系,这意味着所有带有错误的流文件将转到左侧的处理器,而所有没有错误的流文件将传输到标有绿色的连接。

As you can see in the above image the connection marked in red have failure relationship, which means all flowfiles with errors will go to the processor in left and respectively all the flowfiles without errors will be transferred to the connection marked in green.

现在我们继续介绍其他关系。

Let us now proceed with the other relationships.

comms.failure

当由于通信故障而无法从远程服务器获取流文件时,满足此关系。

This relationship is met, when a Flowfile could not be fetched from the remote server due to a communications failure.

not.found

任何流文件,如果我们从远程服务器收到“未找到”消息,将移至 not.found 关系。

Any Flowfile for which we receive a ‘Not Found’ message from the remote server will move to not.found relationship.

permission.denied

当 NiFi 由于权限不足而无法从远程服务器获取流文件时,它将通过此关系移动。

When NiFi unable to fetch a flowfile from the remote server due to insufficient permission, it will move through this relationship.