Support Questions

Find answers, ask questions, and share your expertise

Using InvokeScriptedProcessor with python

New Contributor

Would it be possible to use InvokeScriptedProcessor with python and not jython. I need to use ALPN enhancements (mqtt over 443) and I don't think they will run for jython

2 REPLIES 2

Super Guru

InvokeScriptedProcessor can only use Jython, if you need real Python consider ExecuteStreamCommand. You won't have access to things like attributes or any fancy flow file processing (you can only read the incoming flow file content as STDIN and overwrite the contents as STDOUT), but shelling out to Python does allow you to bring in CPython modules.

Until NiFi can run on Java 9+, you could try InvokeScriptedProcessor with Groovy and this workaround. Once NiFi can run on Java 9+, you can use the built-in ALPN support and won't need Python per se.

New Contributor

Thanks a lot for the answer!

Two additional questions regarding this topic:

  1. Using the ExecuteStreamCommand approach, if there is an error in the python script, is the incoming flowfile lost? How can i manage to keep it in the queue or in another queue?
  2. Using the InvokeScriptedProcessor approach, any recommendation of a MQTT Library to setup something like ssl_context.set_alpn_protocols(['x-amzn-mqtt-ca'])