Skip to main content

Custom Node Types

Custom node types are used to extend the orchestrated nodes of the rule engine. Users create nodes, maintain processing logic, and define parameters; after successful compilation, they can be dragged into the rule flow for use.

Before creating a node​

First, look at the terminology​

TerminologyOn-site understanding
Custom node typeCustom rule function blocks for on-site or project purposes can be dragged into the rule flow after successful compilation.
Node instanceThe node actually dragged into a rule flow canvas and used node. It references a node type.
Input parametersData passed from upstream nodes to the current node.
Output parametersData passed to downstream nodes after processing by the current node.
Input/Output ParametersCan receive upstream data and continue to pass data after modifications within the node.
CompileBuilds the node code and parameter definitions. Check registration and reload the consuming flow before verifying the new behavior.
ClassificationGrouped nodes in the rule node panel for quick on-site search.

Page Entry​

After logging into TGateway Web, click the "Develop Configuration → Custom Node" menu on the left.

Custom Node Management Page

Configure and compile the node​

Page Structure​

AreaDescription
Local nodesManage saved custom node types, supporting addition, editing, compilation, deletion, and batch operations.
Loaded nodesView the types of nodes already available in the rule flow, suitable for confirming whether the compilation result is effective.
Name SearchFilter by node name.
Filter by categoryFilter by node classification.
Tool buttonsOrder: Add, batch compile, batch delete, and refresh; For batch operations, you need to check the node first.

List Field​

FieldDescription
Node NameNode Type Name, which is used in the rule flow to find and use this name.
ClassificationNode classification makes it easier to organize nodes during rule orchestration.
Input ParametersNumber of input parameters defined by the current node.
Output parametersNumber of output parameters defined by the current node.
Input/Output ParametersThe number of parameters that can be both input and output.
Update TimeLast saved or compiled time.
OperationsEdit, compile, or delete the current node.

Create a new node​

Click the 'Add Node' button at the top right of the list to open the "New Custom Node" pop-up.

New Node Dialog

Configuration ItemsDescription
Node NameRequired. It is recommended to use English, numbers, and underlines to keep the rule flow references stable.
ClassificationOptional. Used to organize nodes by business or processing type.
Descriptionoptional. Record node usage, input/output agreements, and maintenance precautions.

After clicking "OK," the system will create a node and automatically enter the node editor.

Node Editor​

The node editor includes the top operation bar, code editing area, and bottom information panel.

Node editor toolbar, code, and bottom panel

AreaDescription
Back ButtonReturns a custom node list.
Node Name TagDisplays the current node name and classification.
Top toolbarRoslyn Service, undo, redo, and compilation share one row. Connection settings are hidden by default; click Roslyn Service to expand or collapse them.
Compile and SaveTop-right action that saves node information and logic before compiling.
Code editingMaintaining node processing logic.
Bottom panelcontains the "Compilation" tabs, "Node Information," and "Parameter Definitions."

Type this. to complete user methods, fields, and generated parameter properties in the node. Signature help follows the call's parentheses and commas. Add /// XML comments to describe methods, fields, and properties in suggestions and hover. The default service is https://roslyn.thingsgateway.cn; a self-hosted Studio is also supported. See Code Completion, Documentation, and Diagnostics.

User-method signature and XML documentation in a custom node

Node Information​

The "Node Information" tab is used to maintain basic information.

FieldsDescription
Node NameNode Display and Reference Name. After modification, you need to compile and save.
ClassificationNode classification.
DescriptionNode purpose, input/output contract, and maintenance notes.

Parameter Definition​

The "Parameter Definition" tab maintains three types of parameters: input, output, and input/output. Parameter definitions affect node connections and data transfer in the rule flow.

Parameter TypeDescription
Input ParameterPassed from the upstream node and read internally by the node.
Output parametersProcessed by nodes and output for downstream nodes.
Input/Output ParametersServes as both input and output, suitable for values that need to be passed after internal node modification.
Parameter fieldDescription
Parameter nameParameter identifier, It is recommended to use clear English or pinyin for the name.
Data TypeParameter Value Type. For numbers, select integer or decimal type; for switches, select boolean type; for text, select strings; and when passing structured content, select object type.
DescriptionParameter Usage Description.

The Web editor offers Int16, Int32, Int64, UInt16, UInt32, UInt64, Byte, Float, Double, Decimal, Boolean, String, Object, and DateTime. Define the type separately for each input, output, and input/output port. Renaming a parameter also requires updating its code references and every consuming flow.

Initial Value Expression is C#, for example Decimal 1m + 1m. An explicit instance input or upstream connection overrides that starting value. Validate integer ranges, use an explicit timezone for dates, and preserve object structure. Event parameters have no state initial value.

Compilation Log​

After clicking "Compile and Save" at the top, the "Compilation Log" at the bottom will display the saving and compilation process.

Diagnostics and error navigation in the node editor

Log entriesDescription:
Saving nodesSave current node information, code, and parameter definitions before compilation.
Node saves successfullyCompilation begins after successful save.
Compilation successfulCustom node code is compiled.
OutputDisplays compiled output information for easy troubleshooting of loading issues.
Error/Warning StatisticsThe right side of the bottom panel displays the current number of errors and warnings.

When a compilation error occurs, first handle the first red error; Click the error item to locate the corresponding code location.

Node saved successfully means the draft source and parameters were stored; compilation can still fail afterward. Reopening retains that draft. Failed output does not replace the previous published node files or registration. Correct the code, compile again, check Loaded Nodes, and reload and verify flows using the type as described below.

If another editor has changed the node, preserve your draft before reading the current revision and comparing changes. Do not overwrite another maintainer's update.

Common Operations​

OperationsSteps
Edit NodesClick "Edit" in the list to enter the editor for maintaining code, node information, or parameter definitions.
Single CompilationClick "Compile" in the list to verify whether the current node can compile.
Batch compileAfter checking multiple nodes, click batch compile. Suitable for unified verification after upgrades.
Delete the nodeClick "Delete" and confirm. Before deletion, confirm that the rule flow no longer references this node.
View Loaded NodesSwitch to "Loaded Nodes" to confirm that nodes are registered at runtime.

Verify node behavior​

Initial values, state, and event ports​

The Web editor generates parameter properties. Do not redeclare them or wrap its member code in another complete class. Use the full-source entry for complete C# node classes and follow Custom Node Development.

Inputs receive upstream values; without a connection use the instance input. State outputs propagate only when their value changes by default. Event ports represent occurrences and can propagate equal payloads repeatedly; do not enter state initial values for event parameters. For inputs 10.1 and 10.2 both rounded to 10, a state receiver may run once while an event receiver runs twice. Check execution and downstream counts.

Verify a revised node​

  1. Compile/save and check name, category, and port types in Loaded Nodes.
  2. Use a disabled test flow with scoped input, numeric extraction, this node, and a downstream receiver. For gain 2 and offset 5, verify 10 → 25 and 20 → 45.
  3. After same-name recompilation, existing flows can retain old instances. Save/reload the consumer and test an input distinguishing the formulas.
  4. Recheck every connection after parameter changes. Disabling stops consumption; reenabling creates fresh state and counters unless persistence is explicitly designed.
  5. Remove all flow references before deletion. A disabled flow still contains references.

Compilation, registration, binding, and downstream feedback all require verification.

Usage Notes​

ScenariosRecommended
Parameter ModificationAfter modifying parameters, the rule flow connection referencing the node should be checked simultaneously.
Category maintenanceClassification affects node search efficiency; it is recommended to classify by business domain or function type.
Compilation failureFirst check the save log, then check the compilation diagnosis; If a save fails, the actual compile will not begin.
node does not appear in the ruleConfirm the node has been successfully compiled and refresh the rule engine page or reopen the flow editor.
Production deletionExport or back up the rule flow before deleting to avoid leaving unresolved node references.