[jira] [Commented] (NIFI-3792) A processor to facilitate retrying FlowFiles
[ https://issues.apache.org/jira/browse/NIFI-3792?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16655407#comment-16655407 ] ASF GitHub Bot commented on NIFI-3792: -- Github user patricker commented on a diff in the pull request: https://github.com/apache/nifi/pull/3090#discussion_r226341579 --- 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"; + +public static final PropertyDescriptor PROP_RETRY_LIMIT = new PropertyDescriptor.Builder() +.name("Retry limit") +.displayName("Retry limit") +.description("The number of times to retry the FlowFile before considering it 'failed' and routing it to 'over limit'.") +.expressionLanguageSupported(VARIABLE_REGISTRY) --- End diff -- What about changing the scope to `FLOWFILE_ATTRIBUTES` so it can be based on a per `FlowFile` basis? > A processor to facilitate retrying FlowFiles > > > Key: NIFI-3792 > URL: https://issues.apache.org/jira/browse/NIFI-3792 > Project: Apache NiFi > Issue Type: New Feature >Reporter: Joseph Percivall >Assignee: Joseph Percivall >Priority: Major > > When dealing with processor failures in production, potentially related to > network issues, the current best practice is to retry the flowfile a couple > times before declaring it a failure[1]. This currently requires multiple > processors and penalizing
[jira] [Commented] (NIFI-3792) A processor to facilitate retrying FlowFiles
[ https://issues.apache.org/jira/browse/NIFI-3792?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16655409#comment-16655409 ] ASF GitHub Bot commented on NIFI-3792: -- Github user patricker commented on a diff in the pull request: https://github.com/apache/nifi/pull/3090#discussion_r226347867 --- 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"; + +public static final PropertyDescriptor PROP_RETRY_LIMIT = new PropertyDescriptor.Builder() +.name("Retry limit") +.displayName("Retry limit") +.description("The number of times to retry the FlowFile before considering it 'failed' and routing it to 'over limit'.") +.expressionLanguageSupported(VARIABLE_REGISTRY) +.required(true) +.addValidator(StandardValidators.INTEGER_VALIDATOR) +.defaultValue("3") +.build(); + +public static final PropertyDescriptor PROP_PENALIZE_FLOWFILE = new PropertyDescriptor.Builder() +.name("Penalize FlowFile") +.displayName("Penalize FlowFile") +.description("If true then the FlowFiles routed to 'retry' will be penalized.") +.allowableValues("true", "false") +.defaultValue("true") +.build(); + +public static final PropertyDescriptor PROP_WARN_ON_OVER_LIMIT = new PropertyDescriptor.Builder() +.name("Warn on 'over limit'") +.display
[jira] [Commented] (NIFI-3792) A processor to facilitate retrying FlowFiles
[ https://issues.apache.org/jira/browse/NIFI-3792?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16655402#comment-16655402 ] ASF GitHub Bot commented on NIFI-3792: -- Github user patricker commented on a diff in the pull request: https://github.com/apache/nifi/pull/3090#discussion_r226340692 --- 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"; + +public static final PropertyDescriptor PROP_RETRY_LIMIT = new PropertyDescriptor.Builder() +.name("Retry limit") --- End diff -- All of your `.name(" ")` need to be changed. It's good that you have separate `name` and `displayName`, but it should be more like, `retry-limit`. > A processor to facilitate retrying FlowFiles > > > Key: NIFI-3792 > URL: https://issues.apache.org/jira/browse/NIFI-3792 > Project: Apache NiFi > Issue Type: New Feature >Reporter: Joseph Percivall >Assignee: Joseph Percivall >Priority: Major > > When dealing with processor failures in production, potentially related to > network issues, the current best practice is to retry the flowfile a couple > times before declaring it a failure[1]. This currently requires multiple > processors and penalizing the flowfile isn't possible. Also if the flow is > not fast enough, back-pressure can cause a livelocked state which requires > manual intervention. > A new processor should be added to not only
[jira] [Commented] (NIFI-3792) A processor to facilitate retrying FlowFiles
[ https://issues.apache.org/jira/browse/NIFI-3792?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16655412#comment-16655412 ] ASF GitHub Bot commented on NIFI-3792: -- Github user patricker commented on a diff in the pull request: https://github.com/apache/nifi/pull/3090#discussion_r226343311 --- 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"; + +public static final PropertyDescriptor PROP_RETRY_LIMIT = new PropertyDescriptor.Builder() +.name("Retry limit") +.displayName("Retry limit") +.description("The number of times to retry the FlowFile before considering it 'failed' and routing it to 'over limit'.") +.expressionLanguageSupported(VARIABLE_REGISTRY) +.required(true) +.addValidator(StandardValidators.INTEGER_VALIDATOR) +.defaultValue("3") +.build(); + +public static final PropertyDescriptor PROP_PENALIZE_FLOWFILE = new PropertyDescriptor.Builder() +.name("Penalize FlowFile") +.displayName("Penalize FlowFile") +.description("If true then the FlowFiles routed to 'retry' will be penalized.") +.allowableValues("true", "false") +.defaultValue("true") +.build(); + +public static final PropertyDescriptor PROP_WARN_ON_OVER_LIMIT = new PropertyDescriptor.Builder() +.name("Warn on 'over limit'") +.display
[jira] [Commented] (NIFI-3792) A processor to facilitate retrying FlowFiles
[ https://issues.apache.org/jira/browse/NIFI-3792?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16655411#comment-16655411 ] ASF GitHub Bot commented on NIFI-3792: -- Github user patricker commented on a diff in the pull request: https://github.com/apache/nifi/pull/3090#discussion_r226344163 --- 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"; + +public static final PropertyDescriptor PROP_RETRY_LIMIT = new PropertyDescriptor.Builder() +.name("Retry limit") +.displayName("Retry limit") +.description("The number of times to retry the FlowFile before considering it 'failed' and routing it to 'over limit'.") +.expressionLanguageSupported(VARIABLE_REGISTRY) +.required(true) +.addValidator(StandardValidators.INTEGER_VALIDATOR) +.defaultValue("3") +.build(); + +public static final PropertyDescriptor PROP_PENALIZE_FLOWFILE = new PropertyDescriptor.Builder() +.name("Penalize FlowFile") +.displayName("Penalize FlowFile") +.description("If true then the FlowFiles routed to 'retry' will be penalized.") +.allowableValues("true", "false") +.defaultValue("true") +.build(); + +public static final PropertyDescriptor PROP_WARN_ON_OVER_LIMIT = new PropertyDescriptor.Builder() +.name("Warn on 'over limit'") +.display
[jira] [Commented] (NIFI-3792) A processor to facilitate retrying FlowFiles
[ https://issues.apache.org/jira/browse/NIFI-3792?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16655401#comment-16655401 ] ASF GitHub Bot commented on NIFI-3792: -- Github user patricker commented on a diff in the pull request: https://github.com/apache/nifi/pull/3090#discussion_r226340682 --- 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"; + +public static final PropertyDescriptor PROP_RETRY_LIMIT = new PropertyDescriptor.Builder() +.name("Retry limit") +.displayName("Retry limit") +.description("The number of times to retry the FlowFile before considering it 'failed' and routing it to 'over limit'.") +.expressionLanguageSupported(VARIABLE_REGISTRY) +.required(true) +.addValidator(StandardValidators.INTEGER_VALIDATOR) +.defaultValue("3") +.build(); + +public static final PropertyDescriptor PROP_PENALIZE_FLOWFILE = new PropertyDescriptor.Builder() +.name("Penalize FlowFile") --- End diff -- Suggestion: `retry-penalize-flowfile` > A processor to facilitate retrying FlowFiles > > > Key: NIFI-3792 > URL: https://issues.apache.org/jira/browse/NIFI-3792 > Project: Apache NiFi > Issue Type: New Feature >Reporter: Joseph Percivall >Assignee: Joseph Percivall >Priority: Major > >
[jira] [Commented] (NIFI-3792) A processor to facilitate retrying FlowFiles
[ https://issues.apache.org/jira/browse/NIFI-3792?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16655408#comment-16655408 ] ASF GitHub Bot commented on NIFI-3792: -- Github user patricker commented on a diff in the pull request: https://github.com/apache/nifi/pull/3090#discussion_r226343199 --- 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"; + +public static final PropertyDescriptor PROP_RETRY_LIMIT = new PropertyDescriptor.Builder() +.name("Retry limit") +.displayName("Retry limit") +.description("The number of times to retry the FlowFile before considering it 'failed' and routing it to 'over limit'.") +.expressionLanguageSupported(VARIABLE_REGISTRY) +.required(true) +.addValidator(StandardValidators.INTEGER_VALIDATOR) +.defaultValue("3") +.build(); + +public static final PropertyDescriptor PROP_PENALIZE_FLOWFILE = new PropertyDescriptor.Builder() +.name("Penalize FlowFile") +.displayName("Penalize FlowFile") +.description("If true then the FlowFiles routed to 'retry' will be penalized.") +.allowableValues("true", "false") +.defaultValue("true") +.build(); + +public static final PropertyDescriptor PROP_WARN_ON_OVER_LIMIT = new PropertyDescriptor.Builder() +.name("Warn on 'over limit'") +.display
[jira] [Commented] (NIFI-3792) A processor to facilitate retrying FlowFiles
[ https://issues.apache.org/jira/browse/NIFI-3792?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16655400#comment-16655400 ] ASF GitHub Bot commented on NIFI-3792: -- Github user patricker commented on a diff in the pull request: https://github.com/apache/nifi/pull/3090#discussion_r226339913 --- 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 { --- End diff -- I really like `Retry` as the processor name. I think it would be more intuitive for most users. > A processor to facilitate retrying FlowFiles > > > Key: NIFI-3792 > URL: https://issues.apache.org/jira/browse/NIFI-3792 > Project: Apache NiFi > Issue Type: New Feature >Reporter: Joseph Percivall >Assignee: Joseph Percivall >Priority: Major > > When dealing with processor failures in production, potentially related to > network issues, the current best practice is to retry the flowfile a couple > times before declaring it a failure[1]. This currently requires multiple > processors and penalizing the flowfile isn't possible. Also if the flow is > not fast enough, back-pressure can cause a livelocked state which requires > manual intervention. > A new processor should be added to not only encourage best practices but also > offer configuration options to deal with un-optimal situations. > [1] > https://community.hortonworks.com/questions/77336/nifi-best-practices-for-error-handling.html -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (NIFI-3792) A processor to facilitate retrying FlowFiles
[ https://issues.apache.org/jira/browse/NIFI-3792?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16655404#comment-16655404 ] ASF GitHub Bot commented on NIFI-3792: -- Github user patricker commented on a diff in the pull request: https://github.com/apache/nifi/pull/3090#discussion_r226341991 --- 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"; + +public static final PropertyDescriptor PROP_RETRY_LIMIT = new PropertyDescriptor.Builder() +.name("Retry limit") +.displayName("Retry limit") +.description("The number of times to retry the FlowFile before considering it 'failed' and routing it to 'over limit'.") +.expressionLanguageSupported(VARIABLE_REGISTRY) +.required(true) +.addValidator(StandardValidators.INTEGER_VALIDATOR) +.defaultValue("3") +.build(); + +public static final PropertyDescriptor PROP_PENALIZE_FLOWFILE = new PropertyDescriptor.Builder() +.name("Penalize FlowFile") +.displayName("Penalize FlowFile") +.description("If true then the FlowFiles routed to 'retry' will be penalized.") +.allowableValues("true", "false") +.defaultValue("true") +.build(); + +public static final PropertyDescriptor PROP_WARN_ON_OVER_LIMIT = new PropertyDescriptor.Builder() +.name("Warn on 'over limit'") +.display
[jira] [Commented] (NIFI-3792) A processor to facilitate retrying FlowFiles
[ https://issues.apache.org/jira/browse/NIFI-3792?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16655406#comment-16655406 ] ASF GitHub Bot commented on NIFI-3792: -- 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? > A processor to facilitate retrying FlowFiles > > > Key: NIFI-3792 > URL: https://issues.apache.org/jira/browse/NIFI-3792 > Project: Apache NiFi > Issue Type: New Feature >Reporter: Joseph Percivall >Assignee: Joseph Percivall >Priority: Major > > When dealing with processor failures in production, potentially related to > network issues, the current best practice is to retry the flowfile a couple > times before declaring it a failure[1]. This currently requires multiple > processors and penalizing
[jira] [Commented] (NIFI-3792) A processor to facilitate retrying FlowFiles
[ https://issues.apache.org/jira/browse/NIFI-3792?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16655405#comment-16655405 ] ASF GitHub Bot commented on NIFI-3792: -- Github user patricker commented on a diff in the pull request: https://github.com/apache/nifi/pull/3090#discussion_r226343019 --- 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"; + +public static final PropertyDescriptor PROP_RETRY_LIMIT = new PropertyDescriptor.Builder() +.name("Retry limit") +.displayName("Retry limit") +.description("The number of times to retry the FlowFile before considering it 'failed' and routing it to 'over limit'.") +.expressionLanguageSupported(VARIABLE_REGISTRY) +.required(true) +.addValidator(StandardValidators.INTEGER_VALIDATOR) +.defaultValue("3") +.build(); + +public static final PropertyDescriptor PROP_PENALIZE_FLOWFILE = new PropertyDescriptor.Builder() +.name("Penalize FlowFile") +.displayName("Penalize FlowFile") +.description("If true then the FlowFiles routed to 'retry' will be penalized.") +.allowableValues("true", "false") +.defaultValue("true") +.build(); + +public static final PropertyDescriptor PROP_WARN_ON_OVER_LIMIT = new PropertyDescriptor.Builder() +.name("Warn on 'over limit'") +.display
[jira] [Commented] (NIFI-3792) A processor to facilitate retrying FlowFiles
[ https://issues.apache.org/jira/browse/NIFI-3792?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16655410#comment-16655410 ] ASF GitHub Bot commented on NIFI-3792: -- Github user patricker commented on a diff in the pull request: https://github.com/apache/nifi/pull/3090#discussion_r226347295 --- 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"; + +public static final PropertyDescriptor PROP_RETRY_LIMIT = new PropertyDescriptor.Builder() +.name("Retry limit") +.displayName("Retry limit") +.description("The number of times to retry the FlowFile before considering it 'failed' and routing it to 'over limit'.") +.expressionLanguageSupported(VARIABLE_REGISTRY) +.required(true) +.addValidator(StandardValidators.INTEGER_VALIDATOR) +.defaultValue("3") +.build(); + +public static final PropertyDescriptor PROP_PENALIZE_FLOWFILE = new PropertyDescriptor.Builder() +.name("Penalize FlowFile") +.displayName("Penalize FlowFile") +.description("If true then the FlowFiles routed to 'retry' will be penalized.") +.allowableValues("true", "false") +.defaultValue("true") +.build(); + +public static final PropertyDescriptor PROP_WARN_ON_OVER_LIMIT = new PropertyDescriptor.Builder() +.name("Warn on 'over limit'") +.display
[jira] [Commented] (NIFI-3792) A processor to facilitate retrying FlowFiles
[ https://issues.apache.org/jira/browse/NIFI-3792?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16655403#comment-16655403 ] ASF GitHub Bot commented on NIFI-3792: -- Github user patricker commented on a diff in the pull request: https://github.com/apache/nifi/pull/3090#discussion_r226340820 --- 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"; + +public static final PropertyDescriptor PROP_RETRY_LIMIT = new PropertyDescriptor.Builder() +.name("Retry limit") +.displayName("Retry limit") +.description("The number of times to retry the FlowFile before considering it 'failed' and routing it to 'over limit'.") +.expressionLanguageSupported(VARIABLE_REGISTRY) +.required(true) +.addValidator(StandardValidators.INTEGER_VALIDATOR) +.defaultValue("3") +.build(); + +public static final PropertyDescriptor PROP_PENALIZE_FLOWFILE = new PropertyDescriptor.Builder() +.name("Penalize FlowFile") +.displayName("Penalize FlowFile") +.description("If true then the FlowFiles routed to 'retry' will be penalized.") +.allowableValues("true", "false") +.defaultValue("true") +.build(); + +public static final PropertyDescriptor PROP_WARN_ON_OVER_LIMIT = new PropertyDescriptor.Builder() +.name("Warn on 'over limit'") --- End diff --
[jira] [Commented] (NIFI-3792) A processor to facilitate retrying FlowFiles
[ https://issues.apache.org/jira/browse/NIFI-3792?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16655092#comment-16655092 ] ASF GitHub Bot commented on NIFI-3792: -- Github user ottobackwards commented on the issue: https://github.com/apache/nifi/pull/3090 I think this general subject, and processor in particular can use some usage documentation, maybe an additional documentation page would be a good addition for this? > A processor to facilitate retrying FlowFiles > > > Key: NIFI-3792 > URL: https://issues.apache.org/jira/browse/NIFI-3792 > Project: Apache NiFi > Issue Type: New Feature >Reporter: Joseph Percivall >Assignee: Joseph Percivall >Priority: Major > > When dealing with processor failures in production, potentially related to > network issues, the current best practice is to retry the flowfile a couple > times before declaring it a failure[1]. This currently requires multiple > processors and penalizing the flowfile isn't possible. Also if the flow is > not fast enough, back-pressure can cause a livelocked state which requires > manual intervention. > A new processor should be added to not only encourage best practices but also > offer configuration options to deal with un-optimal situations. > [1] > https://community.hortonworks.com/questions/77336/nifi-best-practices-for-error-handling.html -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (NIFI-3792) A processor to facilitate retrying FlowFiles
[ https://issues.apache.org/jira/browse/NIFI-3792?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16654108#comment-16654108 ] ASF GitHub Bot commented on NIFI-3792: -- Github user JPercivall commented on the issue: https://github.com/apache/nifi/pull/3090 Hey @patricker, here's the processor I mentioned. It attempts to avert the livelock scenario by looking at the input queue if it's over a certain size/count divert FFs but there's still the chance for livelock in some scenarios. > A processor to facilitate retrying FlowFiles > > > Key: NIFI-3792 > URL: https://issues.apache.org/jira/browse/NIFI-3792 > Project: Apache NiFi > Issue Type: New Feature >Reporter: Joseph Percivall >Assignee: Joseph Percivall >Priority: Major > > When dealing with processor failures in production, potentially related to > network issues, the current best practice is to retry the flowfile a couple > times before declaring it a failure[1]. This currently requires multiple > processors and penalizing the flowfile isn't possible. Also if the flow is > not fast enough, back-pressure can cause a livelocked state which requires > manual intervention. > A new processor should be added to not only encourage best practices but also > offer configuration options to deal with un-optimal situations. > [1] > https://community.hortonworks.com/questions/77336/nifi-best-practices-for-error-handling.html -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (NIFI-3792) A processor to facilitate retrying FlowFiles
[ https://issues.apache.org/jira/browse/NIFI-3792?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16654102#comment-16654102 ] ASF GitHub Bot commented on NIFI-3792: -- GitHub user JPercivall opened a pull request: https://github.com/apache/nifi/pull/3090 NIFI-3792 Adding a RetryCount processor to faciliate retry logic as w… …ell as penalizing a FlowFile. Thank you for submitting a contribution to Apache NiFi. In order to streamline the review of the contribution we ask you to ensure the following steps have been taken: ### For all changes: - [X] Is there a JIRA ticket associated with this PR? Is it referenced in the commit message? - [X] Does your PR title start with NIFI- where is the JIRA number you are trying to resolve? Pay particular attention to the hyphen "-" character. - [X] Has your PR been rebased against the latest commit within the target branch (typically master)? - [X] Is your initial contribution a single, squashed commit? ### For code changes: - [X] Have you ensured that the full suite of tests is executed via mvn -Pcontrib-check clean install at the root nifi folder? - [X] Have you written or updated unit tests to verify your changes? - [X] If adding new dependencies to the code, are these dependencies licensed in a way that is compatible for inclusion under [ASF 2.0](http://www.apache.org/legal/resolved.html#category-a)? - [] If applicable, have you updated the LICENSE file, including the main LICENSE file under nifi-assembly? - [] If applicable, have you updated the NOTICE file, including the main NOTICE file found under nifi-assembly? - [ ] If adding new Properties, have you added .displayName in addition to .name (programmatic access) for each of the new properties? ### For documentation related changes: - [] Have you ensured that format looks appropriate for the output in which it is rendered? ### Note: Please ensure that once the PR is submitted, you check travis-ci for build issues and submit an update to your PR as soon as possible. You can merge this pull request into a Git repository by running: $ git pull https://github.com/JPercivall/nifi NIFI-3792_Adding_a_RetryCount_processor Alternatively you can review and apply these changes as the patch at: https://github.com/apache/nifi/pull/3090.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #3090 commit 2a91eff9948c5b6600a5b64515170d240803d1a3 Author: Joe Percivall Date: 2018-10-17T19:44:04Z NIFI-3792 Adding a RetryCount processor to faciliate retry logic as well as penalizing a FlowFile. > A processor to facilitate retrying FlowFiles > > > Key: NIFI-3792 > URL: https://issues.apache.org/jira/browse/NIFI-3792 > Project: Apache NiFi > Issue Type: New Feature >Reporter: Joseph Percivall >Assignee: Joseph Percivall >Priority: Major > > When dealing with processor failures in production, potentially related to > network issues, the current best practice is to retry the flowfile a couple > times before declaring it a failure[1]. This currently requires multiple > processors and penalizing the flowfile isn't possible. Also if the flow is > not fast enough, back-pressure can cause a livelocked state which requires > manual intervention. > A new processor should be added to not only encourage best practices but also > offer configuration options to deal with un-optimal situations. > [1] > https://community.hortonworks.com/questions/77336/nifi-best-practices-for-error-handling.html -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (NIFI-3792) A processor to facilitate retrying FlowFiles
[ https://issues.apache.org/jira/browse/NIFI-3792?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16653829#comment-16653829 ] Peter Wicks commented on NIFI-3792: --- Sure, thanks [~JPercivall]. We had a list of requirements put together from the other ticket, could you look and see if it covers all of these also? https://issues.apache.org/jira/browse/NIFI-4805?focusedCommentId=16653454&page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel#comment-16653454 If you need any help I'd be happy to make changes on top of what you have put together. > A processor to facilitate retrying FlowFiles > > > Key: NIFI-3792 > URL: https://issues.apache.org/jira/browse/NIFI-3792 > Project: Apache NiFi > Issue Type: New Feature >Reporter: Joseph Percivall >Assignee: Joseph Percivall >Priority: Major > > When dealing with processor failures in production, potentially related to > network issues, the current best practice is to retry the flowfile a couple > times before declaring it a failure[1]. This currently requires multiple > processors and penalizing the flowfile isn't possible. Also if the flow is > not fast enough, back-pressure can cause a livelocked state which requires > manual intervention. > A new processor should be added to not only encourage best practices but also > offer configuration options to deal with un-optimal situations. > [1] > https://community.hortonworks.com/questions/77336/nifi-best-practices-for-error-handling.html -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (NIFI-3792) A processor to facilitate retrying FlowFiles
[ https://issues.apache.org/jira/browse/NIFI-3792?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16653813#comment-16653813 ] Joseph Percivall commented on NIFI-3792: Hey [~patricker], I actually have a working processor that we've been using but just never got around to putting up a PR. It has some handling to try to avoid the livelock but wasn't able to 100% fix due to limitations on knowing about the destination queues from the ontrigger. I'll put up a branch with the Processor this week. > A processor to facilitate retrying FlowFiles > > > Key: NIFI-3792 > URL: https://issues.apache.org/jira/browse/NIFI-3792 > Project: Apache NiFi > Issue Type: New Feature >Reporter: Joseph Percivall >Assignee: Joseph Percivall >Priority: Major > > When dealing with processor failures in production, potentially related to > network issues, the current best practice is to retry the flowfile a couple > times before declaring it a failure[1]. This currently requires multiple > processors and penalizing the flowfile isn't possible. Also if the flow is > not fast enough, back-pressure can cause a livelocked state which requires > manual intervention. > A new processor should be added to not only encourage best practices but also > offer configuration options to deal with un-optimal situations. > [1] > https://community.hortonworks.com/questions/77336/nifi-best-practices-for-error-handling.html -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (NIFI-3792) A processor to facilitate retrying FlowFiles
[ https://issues.apache.org/jira/browse/NIFI-3792?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16653771#comment-16653771 ] Peter Wicks commented on NIFI-3792: --- [~JPercivall] I'm planning to work on this under NIFI-4805. Looks like you've had the ticket assigned since creation about 1.5 years ago. Hope that's not an issue? > A processor to facilitate retrying FlowFiles > > > Key: NIFI-3792 > URL: https://issues.apache.org/jira/browse/NIFI-3792 > Project: Apache NiFi > Issue Type: New Feature >Reporter: Joseph Percivall >Assignee: Joseph Percivall >Priority: Major > > When dealing with processor failures in production, potentially related to > network issues, the current best practice is to retry the flowfile a couple > times before declaring it a failure[1]. This currently requires multiple > processors and penalizing the flowfile isn't possible. Also if the flow is > not fast enough, back-pressure can cause a livelocked state which requires > manual intervention. > A new processor should be added to not only encourage best practices but also > offer configuration options to deal with un-optimal situations. > [1] > https://community.hortonworks.com/questions/77336/nifi-best-practices-for-error-handling.html -- This message was sent by Atlassian JIRA (v7.6.3#76005)