State Manager
From the ProcessContext, ReportingContext, and ControllerServiceInitializationContext,
components are able to call the getStateManager()
method. This State
Manager is responsible for providing a simple API for storing and retrieving state. This
mechanism is intended to provide developers with the ability to very easily store a set of
key/value pairs, retrieve those values, and update them atomically. The state can be stored
local to the node or across all nodes in a cluster. It is important to note, however, that
this mechanism is intended only to provide a mechanism for storing very
simple state. As such, the API simply allows a
Map<String, String>
to be stored and retrieved and for the entire
Map to be atomically replaced. Moreover, the only implementation that is currently supported
for storing cluster-wide state is backed by ZooKeeper. As such, the entire State Map must be
less than 1 MB in size, after being serialized. Attempting to store more than this will
result in an Exception being thrown. If the interactions required by the Processor for
managing state are more complex than this (e.g., large amounts of data must be stored and
retrieved, or individual keys must be stored and fetched individually) than a different
mechanism should be used (e.g., communicating with an external database).