1

I am reviewing the possibility of using NoFlo as an Orchestration Engine. To keep a "Separation Of Concerns", and using NodeJS, I will basically create a RESTful API, using Express, that will have a series of POST and GET requests. This RESTFful API will interact with the Orchestrations, (i.e. NoFlo Graphs and Runtime) by starting and stopping graphs in the runtime. From a behavior point of view, a POST requests will start/stop an Orchestration and a GET requests will get information about the Orchestration (i.e. Status, Errors...). From a state point of view, a POST will create an Orchestration and a GET will enumerate the Orchestration.

Based on what I read in various Stack Posts (i.e. - Starting out with noflo, running it from nodejs) it appears possible but I still have a few questions. Here is one of them.

Is it possible to load a JSON Graph from memory into the Noflo runtime, instead of having a persisted file then loading it into the NoFlo Network from this file? I would like to load the graph as a JSON object.

I am trying to do two thing with this: - Load and Save Graphs to a Database. - Have a UI manage these Graphs in the Database.

Any thoughts on this question and topic would be greatly appreciated.

Community
  • 1
  • 1

1 Answers1

0

Yes, it is possible to make NoFlo run a JSON (or .fbp) graph definition from memory, from a file, wherever.

This happens in two steps:

  1. Load the graph string/object into an instance of noflo.Graph

    noflo.graph.loadJSON(graphDefinition, function (err, graph) {
      if (err) {
        // Handle graph loading errors
      }
      // Now you have a graph object, you can create a network from it
    });
    
  2. Instantiate a NoFlo network based on the graph definition

    noflo.createNetwork(graph, function (err, network) {
      if (err) {
        // Handle network setup/starting errors
      }
      // Now you have a running network object. You can use its
      // lifecycle events and methods to interact with it
    })
    

Additionally the graph object loaded above is "live", so if you make changes to it, the network will react accordingly. This means you can add/change nodes and connections at runtime.

bergie
  • 930
  • 7
  • 8