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

    https://github.com/apache/nifi/pull/3090#discussion_r226345973
  
    --- Diff: 
nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/RetryCount.java
 ---
    @@ -0,0 +1,210 @@
    +/*
    + * Licensed to the Apache Software Foundation (ASF) under one or more
    + * contributor license agreements.  See the NOTICE file distributed with
    + * this work for additional information regarding copyright ownership.
    + * The ASF licenses this file to You under the Apache License, Version 2.0
    + * (the "License"); you may not use this file except in compliance with
    + * the License.  You may obtain a copy of the License at
    + *
    + *     http://www.apache.org/licenses/LICENSE-2.0
    + *
    + * Unless required by applicable law or agreed to in writing, software
    + * distributed under the License is distributed on an "AS IS" BASIS,
    + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    + * See the License for the specific language governing permissions and
    + * limitations under the License.
    + */
    +package org.apache.nifi.processors.standard;
    +
    +import org.apache.nifi.annotation.behavior.InputRequirement;
    +import org.apache.nifi.annotation.behavior.ReadsAttribute;
    +import org.apache.nifi.annotation.behavior.SideEffectFree;
    +import org.apache.nifi.annotation.behavior.SupportsBatching;
    +import org.apache.nifi.annotation.behavior.WritesAttribute;
    +import org.apache.nifi.annotation.documentation.CapabilityDescription;
    +import org.apache.nifi.annotation.documentation.Tags;
    +import org.apache.nifi.annotation.lifecycle.OnScheduled;
    +import org.apache.nifi.components.PropertyDescriptor;
    +import org.apache.nifi.flowfile.FlowFile;
    +import org.apache.nifi.processor.AbstractProcessor;
    +import org.apache.nifi.processor.DataUnit;
    +import org.apache.nifi.processor.ProcessContext;
    +import org.apache.nifi.processor.ProcessSession;
    +import org.apache.nifi.processor.Relationship;
    +import org.apache.nifi.processor.exception.ProcessException;
    +import org.apache.nifi.processor.util.StandardValidators;
    +
    +import java.util.ArrayList;
    +import java.util.Collections;
    +import java.util.HashSet;
    +import java.util.List;
    +import java.util.Optional;
    +import java.util.Set;
    +
    +import static 
org.apache.nifi.processors.standard.RetryCount.RETRY_COUNT_ATTRIBUTE_KEY;
    +import static 
org.apache.nifi.annotation.behavior.InputRequirement.Requirement.INPUT_REQUIRED;
    +import static 
org.apache.nifi.expression.ExpressionLanguageScope.VARIABLE_REGISTRY;
    +
    +/**
    + * Created by jpercivall on 3/17/17.
    + */
    +@SupportsBatching
    +@SideEffectFree
    +@InputRequirement(INPUT_REQUIRED)
    +@Tags({"penalize", "retry", "penalize"})
    +@CapabilityDescription("Used to facilitate retrying a FlowFile a set 
number of times before considering the FlowFile 'failed'. Can also be used as a 
utility to penalize FlowFiles.")
    +@WritesAttribute(attribute = RETRY_COUNT_ATTRIBUTE_KEY, description = "The 
number of times this FlowFile has been routed to 'Retry'.")
    +@ReadsAttribute(attribute = RETRY_COUNT_ATTRIBUTE_KEY, description = "The 
number of times this FlowFile has been routed to 'Retry'.")
    +public class RetryCount extends AbstractProcessor {
    +
    +    public static final String RETRY_COUNT_ATTRIBUTE_KEY = 
"retryCountProcessor.timesRetried";
    --- End diff --
    
    It came up in discussions on the Jira for the Delay processor that having a 
fixed retry count attribute could be tricky. How do you handle Retry attribute 
contamination? If this gets set in an upstream flow, and then the same FlowFile 
goes through a new Retry loop later on in the Flow, won't this attribute cause 
the FlowFile to behave as though it has already been retried?
    
    The workaround for this we came up with was to append the Processor UUID to 
the attribute name. Thoughts?


---

Reply via email to