[
https://issues.apache.org/jira/browse/NIFI-1766?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15241934#comment-15241934
]
Matt Brown commented on NIFI-1766:
----------------------------------
Hi Joe,
Thanks for the explanation, that makes sense. Sorry, I didn't mention it in the
ticket but, yes, I have seen the behaviour that I described above when I was
running a test using the TestRunner and this probably led me to misinterpret
the JavaDoc.
Here's some background details:
This issue arose while I was looking into creating a PutTCP Processor. I
created a basic implementation that inherited from AbstractPutEventProcessor
and wrote a quick unit test using the TestRunner that enqueued five FlowFiles
and then called run() to push them through the Processor under test. I
implemented a TCP Test server to receive the files and also added functionality
to the server to count the number of TCP connections that it receives. The test
failed because the TCP server received five connections rather than the
expected one. I then stepped through the JUnit test case with a debugger and
saw that @OnScheduled methods were being called before each OnTrigger() call
and similarly the @OnStopped methods were being called after each OnTrigger()
call.
I may have made a mistake in the way I implemented the test that caused this
behaviour, or the TestRunner may work differently to what you described above?
I would also be interested in building the whole application and running it up
with a PutTCP processor to check that it sends out the files on a single TCP
connection. Are you happy to wait for me to test this first before closing the
issue to see whether there is a discrepancy between the behaviour of the
TestRunner and the real framework?
Regards
Matt
> AbstractPutEventProcessor - the sender pool object and sender objects are
> recreated before and after every call to OnTrigger() respectively.
> --------------------------------------------------------------------------------------------------------------------------------------------
>
> Key: NIFI-1766
> URL: https://issues.apache.org/jira/browse/NIFI-1766
> Project: Apache NiFi
> Issue Type: Bug
> Components: Core Framework
> Affects Versions: 0.6.0
> Reporter: Matt Brown
> Priority: Minor
> Attachments: 0001-NIFI-1766.patch
>
>
> AbstractPutEventProcessor creates the sender pool list object in the
> OnScheduled() method which is annotated with @OnScheduled. This method
> therefore gets called before every OnTrigger() call. The sender pool is
> therefore being recreated for every single FlowFile that is handled by
> OnTrigger(). Is this the correct behaviour? I was expecting the pool to be
> created once for the lifetime of the Processor instance.
> Similarly, the sender objects within the sender pool are being closed down by
> the closeSenders() method which is annotated with @OnStopped. This method
> therefore gets called after each OnTrigger() call has completed. The senders
> are therefore being deleted after every OnTrigger() call (and then recreated
> in the next OnTrigger() call). Is this the intended behaviour? For TCP
> senders, this means that each FlowFIle is sent over a new TCP connection. I
> was expecting all FlowFiles to be sent out over the same TCP connection.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)