Joseph Witt commented on NIFI-2372:

I don' think this would be possible without having a different API specific to 
processors which have no ability to construct process sessions on their own but 
rather only use what is passed into them.  Also this probably violates some 
assumptions about process session lifecycle.  Alternative approaches should be 

> Allow ProcessSession to be passed to operations annotated with @OnUnscsheduled
> ------------------------------------------------------------------------------
>                 Key: NIFI-2372
>                 URL: https://issues.apache.org/jira/browse/NIFI-2372
>             Project: Apache NiFi
>          Issue Type: Improvement
>          Components: Core Framework
>            Reporter: Oleg Zhurakousky
>            Assignee: Oleg Zhurakousky
>            Priority: Minor
> With adoption of NiFi there are more and more cases where Processors that 
> source their data from the external systems (e.g., Email, JMS, MQTT etc) may 
> need to hold an internal queue of data to be sent as content in individual 
> FlowFiles. This implies somewhat of a persistent *state* between subsequent 
> invocation of the _onTriggered(..)_ operation. This creates a problem for the 
> processors that still have data in the internal data queue while being 
> stopped. 
> While stoping of the processor is not a real issue (since the instance of the 
> processor is preserved), the subsequent stopping of NiFi that may follow is. 
> One of the way of dealing with it is to drain the internal data queue  before 
> shitting down processor, but that requires access to ProcessSession which is 
> not currently supported by NiFi to operations annotated with 
> _@OnUnscheduled_, resulting in variety of workarounds (e.g., have 
> ProcessSession as instance variable of the Processor instance, etc.).

This message was sent by Atlassian JIRA

Reply via email to