Peter Turcsanyi created NIFI-9391:
-------------------------------------

             Summary: MergeRecord does not work in stateless flows
                 Key: NIFI-9391
                 URL: https://issues.apache.org/jira/browse/NIFI-9391
             Project: Apache NiFi
          Issue Type: Bug
          Components: Extensions
            Reporter: Peter Turcsanyi
            Assignee: Peter Turcsanyi


The stateless runtime triggers a processor up until FFs are available in the 
upstream queue.

MergeRecord needs an extra onTrigger() call where session.get() yields no 
result in order to get notified that no more FFs are available and it is time 
to send the merged FF downstream. This extra call will never happen in 
stateless environment and MergeRecord cannot send out FF in this way.

Modify MergeRecord to run session.get() in a loop within a single onTrigger() 
call like MergeContent does:
{code:java}
while (binManager.getBinCount() <= 
context.getProperty(MAX_BIN_COUNT).asInteger()) {
    if (!isScheduled()) {
        break;
    }

    final ProcessSession session = sessionFactory.createSession();
    final List<FlowFile> flowFiles = session.get(1000);
    if (flowFiles.isEmpty()) {
        break;
    }
    ... 
{code}
NIFI-9390 also affects MergeContent when it is not in the starting position in 
the flow but this jira needs to be fixed first (otherwise the other cannot pop 
up).



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

Reply via email to