Rakesh,

The ExecuteScript Cookbook series [1] by Matt Burgess is a great introduction 
to scripting in nifi.

The essence of it is that you need to use the session object (which is provided 
for you automatically) to get a flow file:

flowFile = session.get();

Assuming the flowFile is not null/nil/None, you would then use session.write, 
providing your own subclass of StreamCallback, to rewrite the contents 
according to your specifications.

Please note that you do not necessarily need to use groovy. You could use 
python, lua, javascript, or others if you are more comfortable with any of 
those.

Regards,

Andy

[1] 
https://community.hortonworks.com/articles/75032/executescript-cookbook-part-1.html

On 10/18/17, 5:22 AM, "rakesh" <[email protected]> wrote:

    Hi All,
    
    
    I have a JOSN Flow file 
    
    
<http://apache-nifi-users-list.2361937.n4.nabble.com/file/t310/NifiRedHelp.png> 
     From this  I want to make it like
    
    
<http://apache-nifi-users-list.2361937.n4.nabble.com/file/t310/NifiHelp.png> 
    
    To accomplish this task I selected ExecuteScript Processor using Groovy
    script.
    I have a regex which matches *Mon Oct 09 23:38:55 IST 2017* and I want to
    read the json data and check the regex condition to format is like
    *toDate("EEE MMM dd HH:mm:ss z yyyy"):toNumber():format("yyyy-MM-dd
    HH:mm:ss.S")*  and overwrite it to same flow file.
    
    I'm new to Groovy scripting.
    
    Any Suggestions any suggestions would be appreciated.
    
    
    
    Thanks
    Rakesh.
    
    
    
    --
    Sent from: http://apache-nifi-users-list.2361937.n4.nabble.com/
    
    

Reply via email to