Mark Payne created NIFI-6678: -------------------------------- Summary: Introduce a notion on `PropertyDescriptor` that indicates that any change to the property should reset component's state Key: NIFI-6678 URL: https://issues.apache.org/jira/browse/NIFI-6678 Project: Apache NiFi Issue Type: Improvement Components: Core Framework Reporter: Mark Payne
We have several cases where Processor implement logic in `onPropertyModified` so that if a Property of interest has its value changed, we set a flag that indicates that state must be cleared. Then, in an `@OnScheduled` method, we clear the state as appropriate. This is problematic for a couple of reasons: # It's easy to get the logic incorrect. If this is on in `onTrigger` for instance, it can result in state being inadvertently cleared when Primary Node changes. # It's been implemented a few different times across different components, which means that clearing of the state may be a good feature to implement at the framework level. # NIFI-2592 aims to address the fact that we call `@OnScheduled` method on nodes that are not the Primary Node. If this changes, the current algorithm will start to cause state to be inadvertently cleared. So, I recommend adding a new method to the `PropertyDescriptor.Builder`: {code:java} Builder clearStateOnChange(Scope... scope); {code} Then, a component can simply indicate in the Property Descriptor that any changes to the property value requires that the component's state be cleared. The given argument for `Scope` indicates whether LOCAL state, CLUSTER state, both, or neither should be cleared, defaulting to neither (an empty array). -- This message was sent by Atlassian Jira (v8.3.2#803003)