Hey Rick,
Calling commit() isn't necessary. The ProcessorSession logic is typically 
handled by the AbstractProcessor class: if the onTrigger method throws an 
Exception, the AbstractProcessor will catch the Exception, call 
session.rollback(), and then re-throw the Exception. Otherwise, the 
AbstractProcessor will call commit() on the ProcessSession.
It's documented in the developer guide under "Session Rollback". 
Joe- - - - - - Joseph Percivalllinkedin.com/in/Percivalle: 
[email protected]
 


     On Tuesday, September 8, 2015 2:54 PM, Rick Braddy <[email protected]> 
wrote:
   

 Hi,

During development of some new processors, I have been looking closely at 
standard processors to understand best practices. The Developer Guide suggests 
that one should call session "commit()" upon completion of onTrigger() session 
processing, which makes sense.  However, I notice in a number of standard 
processors that commit() is not called at all; e.g., see SplitText processor as 
an example of this.  Session transfer() gets called but no commit() calls.

So my question is the commit() call necessary, or are sessions being 
auto-committed if not rolled back?  Is there some penalty to calling session 
commit() vs. just calling transfer.

Sorry for so many questions, but without a Nifi API reference guide, this seems 
like the fastest way to understand what's intended by the framework.

Thanks
Rick

  

Reply via email to