Search in sources :

Example 1 with StandardFlowSynchronizer

use of org.apache.nifi.controller.StandardFlowSynchronizer in project nifi by apache.

the class StandardXMLFlowConfigurationDAO method load.

@Override
public synchronized void load(final FlowController controller, final DataFlow dataFlow) throws IOException, FlowSerializationException, FlowSynchronizationException, UninheritableFlowException, MissingBundleException {
    final FlowSynchronizer flowSynchronizer = new StandardFlowSynchronizer(encryptor, nifiProperties);
    controller.synchronize(flowSynchronizer, dataFlow);
    if (StandardFlowSynchronizer.isEmpty(dataFlow)) {
        // If the dataflow is empty, we want to save it. We do this because when we start up a brand new cluster with no
        // dataflow, we need to ensure that the flow is consistent across all nodes in the cluster and that upon restart
        // of NiFi, the root group ID does not change. However, we don't always want to save it, because if the flow is
        // not empty, then we can get into a bad situation, since the Processors, etc. don't have the appropriate "Scheduled
        // State" yet (since they haven't yet been scheduled). So if there are components in the flow and we save it, we
        // may end up saving the flow in such a way that all components are stopped.
        // We save based on the controller, not the provided data flow because Process Groups may contain 'local' templates.
        save(controller);
    }
}
Also used : StandardFlowSynchronizer(org.apache.nifi.controller.StandardFlowSynchronizer) FlowSynchronizer(org.apache.nifi.controller.serialization.FlowSynchronizer) StandardFlowSynchronizer(org.apache.nifi.controller.StandardFlowSynchronizer)

Aggregations

StandardFlowSynchronizer (org.apache.nifi.controller.StandardFlowSynchronizer)1 FlowSynchronizer (org.apache.nifi.controller.serialization.FlowSynchronizer)1