Mustarshad
Mustarshad

Reputation: 1

Cannot import StreamCallback, ioUtils in ExecuteStreamCommand Processor in NiFi

I'm trying to execute python code in the executestreamcommand processor, and trying to read/write flow files in the code, for that i have to use certain libraries for example

in libraries for example But I'm getting error in executeStreamCommand that No Module found. anyone knows the reason ?

Upvotes: 0

Views: 980

Answers (1)

Andy
Andy

Reputation: 14194

ExecuteStreamCommand is used to execute shell commands (scripts, utilities, etc.) on the command-line (a.k.a. terminal). The NiFi internal libraries are not available to scripts running in that context unless you explicitly bundle and import them in those scripts. The interaction with NiFi is limited to flowfile content being streamed via STDIN and STDOUT in that case. See this answer for more details.

If you want to use a Python script to read directly from NiFi flowfile attributes and content and implement a custom StreamCallback, you should use ExecuteScript or InvokeScriptedProcessor. This allows more tightly-coupled integration with NiFi concepts, but for Python specifically, means that natively-compiled modules (Python modules written in C) are not available, because NiFi uses Jython (JSR-223 compatible).

Upvotes: 2

Related Questions