Support Questions
Find answers, ask questions, and share your expertise

Proper way to go about getting input data for python scripted processor from the dynamic properties?

New Contributor

Hello all,

    I am trying to make a small scripted processor (via InvokeScriptedProcessor using a template created by @mburgess https://gist.github.com/mattyb149/fa02e1060b0a6dc9f2a3c119863e862b ) that acts as a separate reusable logger that uses the dynamic properties as the log info and message then writes it to disk. I tried simply using getattribute, but of course, the dynamic data had not been added as an attribute yet (and, honestly, I would rather it didn't, but I don't think I have much of a choice if I am not writing an actual Java processor?).

    Is there a way to get this data using python if it has not yet been added as an attribute? If so, once I write my log file, is there a way to remove those properties from the flowFile instead of them being added as attributes once my processor has completed its objective?

 

Thanks,

-id

1 REPLY 1

New Contributor

I got it all worked out. After searching through some of the tests in the nifi repo I came across a new methods for dealing with properties and I was able to figure out how to build what I wanted. Though, doing it in python felt... unstable at best, so I rewrote the processor in Groovy and now it's working just as I had hoped.

; ;