Github user markap14 commented on a diff in the pull request:

    https://github.com/apache/nifi/pull/987#discussion_r77649182
  
    --- Diff: 
nifi-nar-bundles/nifi-kafka-bundle/nifi-kafka-0-9-processors/src/main/java/org/apache/nifi/processors/kafka/pubsub/ConsumerLease.java
 ---
    @@ -47,22 +156,244 @@
          * kafka client to collect more data from Kafka before committing the
          * offsets.
          *
    -     * @param offsets offsets
    -     * @throws KafkaException if issue occurs talking to underlying 
resource.
    +     * if false then we didn't do anything and should probably yield if 
true
    +     * then we committed new data
    +     *
    +     */
    +    boolean commit() {
    +        if (uncommittedOffsetsMap.isEmpty()) {
    +            resetInternalState();
    +            return false;
    +        }
    +        try {
    +            /**
    +             * Committing the nifi session then the offsets means we have 
an at
    +             * least once guarantee here. If we reversed the order we'd 
have at
    +             * most once.
    +             */
    +            final Collection<FlowFile> bundledFlowFiles = getBundles();
    +            if (!bundledFlowFiles.isEmpty()) {
    +                getProcessSession().transfer(getBundles(), REL_SUCCESS);
    --- End diff --
    
    Is there a reason we're calling getBundles() again here, instead of just 
calling transfer with the bundledFlowFiles variable? getBundles() is fairly 
expensive to be calling again needlessly.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

Reply via email to