Scope

When communicating with the State Manager, all method calls require that a Scope be provided. This Scope will either be Scope.LOCAL or Scope.CLUSTER. If NiFi is run in a cluster, this Scope provides important information to the framework about how the operation should occur.

If state as stored using Scope.CLUSTER, then all nodes in the cluster will be communicating with the same state storage mechanism. If state is stored and retrieved using Scope.LOCAL, then each node will see a different representation of the state.

It is also worth noting that if NiFi is configured to run as a standalone instance, rather than running in a cluster, a scope of Scope.LOCAL is always used. This is done in order to allow the developer of a NiFi component to write the code in one consistent way, without worrying about whether or not the NiFi instance is clustered. The developer should instead assume that the instance is clustered and write the code accordingly.