You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@nifi.apache.org by Dmitry Lukyanov <dl...@ukr.net> on 2017/03/12 21:43:45 UTC

nifi groovy processor contribuion

Hello Devs, 

I'd like to contribute better groovy processor for nifi. 
We are going to use it in production.. 
Questions: 
- Do you think Is it interesting? 
- If yes, where i should start? From master or specific branch? 

The main features: 
- it's absolutely compatible with existing Execute Script / Groovy 
- if property starts with `CTL.` - it's possible to connect to any controller service 
� by this it's possible to connect several databases, jms, cache, ...� in one processor and mix data 
- if connection pool connected to script then connection taken from pool and provided to script as groovy.sql.Sql 
� http://docs.groovy-lang.org/latest/html/api/groovy/sql/Sql.html 
� all sql connections are committed on script success and rolled back on exception 
- Script now is more groovy: 
� def ff = session.get() 
� if( !ff ) return 
� ff.myAttr = 'The New Attr Value' 
� def row = CTL.mydb.firstRow("select sysdate as DAT from dual") 
� ff.write('UTF-8') { writer-> writer << groovy.json.JsonOutput.toJson(row) } 
� REL_SUCCESS << ff 
- Exception policy: `rollback` or `transfer to failure` 


-- 
Regards, 
Dmitry 

Re: nifi groovy processor contribuion

Posted by Matt Burgess <ma...@apache.org>.
Dmitry,

This sounds very interesting, thank you for sharing!  Do you think the
'CTL' type access to Controller Services would benefit the other
ExecuteScript-supported languages as well? If so, I would be very
interested in seeing your work on the processor, perhaps we could
include some of these improvements "across the board" for all/many of
the supported languages.

Regards,
Matt

On Sun, Mar 12, 2017 at 5:43 PM, Dmitry Lukyanov <dl...@ukr.net> wrote:
> Hello Devs,
>
> I'd like to contribute better groovy processor for nifi.
> We are going to use it in production..
> Questions:
> - Do you think Is it interesting?
> - If yes, where i should start? From master or specific branch?
>
> The main features:
> - it's absolutely compatible with existing Execute Script / Groovy
> - if property starts with `CTL.` - it's possible to connect to any controller service
>   by this it's possible to connect several databases, jms, cache, ...  in one processor and mix data
> - if connection pool connected to script then connection taken from pool and provided to script as groovy.sql.Sql
>   http://docs.groovy-lang.org/latest/html/api/groovy/sql/Sql.html
>   all sql connections are committed on script success and rolled back on exception
> - Script now is more groovy:
>   def ff = session.get()
>   if( !ff ) return
>   ff.myAttr = 'The New Attr Value'
>   def row = CTL.mydb.firstRow("select sysdate as DAT from dual")
>   ff.write('UTF-8') { writer-> writer << groovy.json.JsonOutput.toJson(row) }
>   REL_SUCCESS << ff
> - Exception policy: `rollback` or `transfer to failure`
>
>
> --
> Regards,
> Dmitry