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

Giovanni Lanzani edited comment on NIFI-3408 at 2/1/17 12:24 PM:
-----------------------------------------------------------------

Just to be sure: to me it seems like InvokeHTTP.java needs the following.

Lines 751-757 could be updated to this

{code:java}
        } catch (final Exception e) {
            // penalize or yield
            if (requestFlowFile != null) {
                logger.error("Routing to {} due to exception: {}", new 
Object[]{REL_FAILURE.getName(), e}, e);
                requestFlowFile = session.penalize(requestFlowFile);
                requestFlowFile = session.putAttribute(requestFlowFile, 
"InvokeHTTP.Exception", e.getClass().toString());)   // <-- THIS IS NEW
                // transfer original to failure
                session.transfer(requestFlowFile, REL_FAILURE);
{code}

I we agree on the attribute name (InvokeHTTP.Exception now) and the fact that 
we only pass the exception class, should I create a PR with this code? (I 
haven't looked at how to contribute to NiFi yet



was (Author: lanzani):
Just to be sure: to me it seems like this InvokeHTTP.java needs updates.
Specifically the lines 751-757 could be updated to this

{code:java}
        } catch (final Exception e) {
            // penalize or yield
            if (requestFlowFile != null) {
                logger.error("Routing to {} due to exception: {}", new 
Object[]{REL_FAILURE.getName(), e}, e);
                requestFlowFile = session.penalize(requestFlowFile);
                requestFlowFile = session.putAttribute(requestFlowFile, 
"InvokeHTTP.Exception", e.getClass().toString());)   // <-- THIS IS NEW
                // transfer original to failure
                session.transfer(requestFlowFile, REL_FAILURE);
{code}

I we agree on the attribute name (InvokeHTTP.Exception now) and the fact that 
we only pass the exception class, should I create a PR with this code? (I 
haven't looked at how to contribute to NiFi yet


> Add an attribute for failure reason to InvokeHTTP in all cases to match docs
> ----------------------------------------------------------------------------
>
>                 Key: NIFI-3408
>                 URL: https://issues.apache.org/jira/browse/NIFI-3408
>             Project: Apache NiFi
>          Issue Type: Improvement
>            Reporter: Joseph Percivall
>            Priority: Minor
>
> Originally brought up on the mailing list[1], the InvokeHTTP docs state:
> ```
> The original FlowFile will be routed on any type of connection failure, 
> timeout or general exception. It will have new attributes detailing the 
> request.
> ```
> Adding attributes currently only happens though when a response is received 
> from the server, so not attributes if it fails to connect or the socket times 
> out.
> These attributes should be added.
> [1] 
> http://apache-nifi-users-list.2361937.n4.nabble.com/InvokeHTTP-and-SocketTimeoutException-td743.html



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Reply via email to