Flowgear Nodes are the building blocks of an integration. The Flowgear Nodes Test Harness makes it easy for developers to build and debug Nodes.
You will need
- Visual Studio 2015/2017 (Run as Administrator)
- Install a DropPoint on your development machine (requires Flowgear DropPoint v4.3 or later)
Creating a Project
- Create a Class Library project in Visual Studio targeting .NET Framework 4.5.1. This will be the assembly that contains your Node (or Nodes).
- Create a second Console Application project in the same solution, it also needs to target .NET Framework 4.5.1.
- Reference the Class library project in your Console Application project
- In your Class Library project, add a nuget reference to
Flowgear.Sdk. To do this, locate the Package Manager Console in Visual Studio and enter the command
- In your Console Application project, add a nuget reference to
Flowgear.Nodes.TestHarnessusing the command
- Sign both projects. (You do not need to use your production certificate. Signing the projects up-front ensures that they can only reference signed assemblies).
- Add a 16x16 PNG to the Class Library, this will be the icon used to represent your Node. Set the
- Create the structure of your Node using the template shown below
- In your Console Application, add the harness loader code shown below
- Set the Console Application to be the Startup Project for the Solution and launch the project
- In the Flowgear Console, open or add a Workflow. Click the + button on the Design Canvas to add an object and tap
Debug a Node.
- Tap the DropPoint that is running on the development machine
- Flowgear will add the Node to the Design Canvas. If you make changes to the Node (eg. add properties, implement optional methods, etc), you can update the Node UI by tapping Node settings (cog button) and choosing
- Run the Workflow to invoke the Node.
- You can also create and test Connections (if your Node defines a Connection) by tapping the Connection property and clicking the + button
Harness Loader Code
Place the Harness reference code in the Main method of your C# Console Application project.
Example Node Class
Place the Custom Node reference code in its own class in a C# Console Application
- Create an XML file that confirms to the Node Sample Schema.
- When providing values for the Properties on the Node, you can either provide a text value in the
Valueattribute or if the value is a document or large string, point to a file in a sub-folder with a relative path by using the
- For XML properties, you can also optionally supply a schema file by providing a value for the
SchemaFileattribute. If you don't provide a schema for an XML property, Flowgear will infer a schema for you.
- Run your Node via the Test Harness, add it to a Workflow as described above and then click
Settings(cog icon) and
Choose Sampleson the Node.
- All samples will be immediately syntactically validated.
Publishing Your Node
- In the Console, click Nodes and then click the
+icon to upload a Node.
- Select the Account you would like to publish the Node from and then point to a Zip archive of the binaries for the Node (typically, the contents of the bin\Release folder should be zipped).
- Tick the
Make this Node Public checkboxif you would like the Node to be reviewed and published to all users on approval. If this is left unchecked, the Node will only be available for your use.
- Once a Node has been uploaded, you can access it from the Nodes Pane where you will see an
Ownedlabel against the Node. Click the Node for more information and to upload Samples and save Node Configurations
- To upload samples, create a Zip archive of the contents of your samples folder including any referenced files. Click
Upload Samplesand point to the archive. Once it's uploaded, click
- To change Node Configuration, modify the content of the
Configurationtextbox and click
Unable to connect to Test Harness
Ensure that you have selected the correct DropPoint and that your Visual Studio project is running on the same machine as the DropPoint. It may also be necessary to run Visual Studio as Administrator (if you don't do this, it may not be able to establish a connection to the DropPoint service).
Request for the permission of type ... failed
Nodes are not permitted to perform certain actions within the Flowgear Cloud environment. Set the appropriate RunFrom value in the Node attribute on your class. All permissions except RunFrom.DropPointUnrestrictedOnly will apply sandbox permissions similar to those of our Cloud environment so that you are able to identify any potential security issues during debugging.
To identify the source of this exception in your Node, check the Common Language Runtime Exceptions checkbox under the Exceptions pane in Visual Studio. In your own code, ensure you are not attempting to access resources such as the File System, Registry, Environment variables and are not calling functions in the System.Reflection namespace.
If the permission exception is triggered by a third party library that you are referencing, review the source code of the library. If the source code is not available, use ILDASM, ILSpy or .NET Reflector to review the source code.
If it is not possible to avoid violating the permission requirement, you can still publish your Node but it will only execute when routed through a DropPoint.