[ 
https://issues.apache.org/jira/browse/NIFI-2039?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15359328#comment-15359328
 ] 

ASF GitHub Bot commented on NIFI-2039:
--------------------------------------

GitHub user markap14 opened a pull request:

    https://github.com/apache/nifi/pull/601

    NIFI-2039: Provide a new ProcessSession.read() method that provides an 
InputStream instead of using a callback

    

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/markap14/nifi NIFI-2039

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/nifi/pull/601.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #601
    
----
commit e84817b56792b2bbcfae477f53694b3c4b96abd8
Author: Mark Payne <[email protected]>
Date:   2016-07-01T17:24:12Z

    NIFI-2039: Provide a new ProcessSession.read() method that provides an 
InputStream instead of using a callback

----


> Provide ability to get InputStream from FlowFile without using Process 
> Session callback
> ---------------------------------------------------------------------------------------
>
>                 Key: NIFI-2039
>                 URL: https://issues.apache.org/jira/browse/NIFI-2039
>             Project: Apache NiFi
>          Issue Type: Improvement
>          Components: Core Framework
>            Reporter: Mark Payne
>            Assignee: Mark Payne
>             Fix For: 1.0.0
>
>
> Provide a mechanism to obtain an InputStream for a FlowFile directly from the 
> ProcessSession without having to provide an InputStreamCallback.
> Currently, we often have processors that create an AtomicReference so that 
> the value can be set within a callback and then the value must be obtained 
> using a get() once the callback returns. This is very un-intuitive. 
> Additionally, we don't have the ability to return an InputStream to other 
> code that may required to run in a callback. For instance, when using 
> Calcite, Calcite wants a callback, essentially, that provides an Enumerator 
> of data. We can't currently support this well because we can't create an 
> InputStream and return it.
> We need to add the following method to ProcessSession:
> InputStream read(FlowFile flowFile) throws ProcessException;
> The InputStream that is returned must be tracked by ProcessSession such that 
> when the session is committed or rolled back, the stream is closed if it 
> hasn't been already. All of the logic that currently takes place in 
> ProcessSession.read() after the callback returns must be done on the closing 
> of the new InputStream that is returned.
> The MockProcessSession should throw an Exception if commit() is called 
> without the InputStream being closed, ideally providing the stack trace of 
> where the stream was obtained and where commit() was called. This is to 
> ensure that the developer is being a good consumer, but the 
> StandardProcessSession doesn't really need to do this, as we can simply close 
> the InputStream so that it can no longer be consumed.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to