I don’t see any response from postHttp. You just invoke a method and that’s it. 
I thought you said you need to send the results of HTTP Post (json) downstream. 
If so you should receive response form HTTP and create a new FlowFile 
(session.create(..) or session.clone(..)) and write the contents of the HTTP 
response to it (session.write(..)).

Cheers
Oleg

> On Apr 18, 2016, at 8:58 AM, idioma <corda.ila...@gmail.com> wrote:
> 
> Oleg,
> this is actually a great idea, I will follow it for certain (a good
> compromise, too). I have an additional question on the onTrigger method for
> my Post Http. Among the main NiFi components, my custom processor contains a
> number of separate methods, in particular one that send a Post HTTP request
> to an endpoint and return a Json response. The method takes a number of
> parameter such as userId, password, etc and this is where I am rather
> confused when it comes to the operations I should be perform in my on
> Trigger. I have the following: 
> 
>   @Override
>    public void onTrigger(final ProcessContext context, final ProcessSession
> session) throws ProcessException {
> 
>        FlowFile flowFile = session.get();
>        if (flowFile == null) return;
> 
>        final String userId = context.getProperty(USER_ID).getValue();
>        final String password = context.getProperty(PASSWORD).getValue();
>        final String http_post_url =
> context.getProperty(HTTP_POST_URL).getValue();
> 
>        final AtomicReference<String> httpPostRequestHolder = new
> AtomicReference<>();
>        session.read(flowFile, new InputStreamCallback() {
>            @Override
>            public void process(InputStream inputStream) throws IOException
> {
>                StringWriter strWriter = new StringWriter();
>                IOUtils.copy(inputStream, strWriter, "UTF-8");
>                httpPostRequestHolder.set(userId);
>                httpPostRequestHolder.set(password);
>                httpPostRequestHolder.set(http_post_url);
>            }
>        });
> 
>         try {
>            postHttpRequest(userId, password, http_post_url);
>            session.transfer(flowFile, SUCCESS);
>        } catch (IllegalArgumentException ex) {
>            session.transfer(flowFile, FAILURE);
>            ex.printStackTrace();
>        }
> 
> Is that what I am supposed to do? Is that correct? I am trying to process
> the inputstream and convert it into an AtomicReference object with the same
> arguments as the one passed in the postHttpRequest method. Does it make
> sense? 
> 
> Thank you again for all your help, so much appreciated!
> 
> 
> 
> 
> 
> --
> View this message in context: 
> http://apache-nifi-developer-list.39713.n7.nabble.com/Is-my-custom-processor-doing-too-many-things-OnTrigger-question-tp9225p9232.html
> Sent from the Apache NiFi Developer List mailing list archive at Nabble.com.
> 

Reply via email to