工作流

This commit is contained in:
PandaGoAdmin
2023-03-31 11:39:11 +08:00
parent b247985bbe
commit f7f9e67c95
16 changed files with 951 additions and 0 deletions

View File

@@ -0,0 +1,34 @@
package nodes
import (
"github.com/sirupsen/logrus"
"pandax/pkg/flow_engine/message"
)
const InputNodeName = "InputNode"
type inputNode struct {
bareNode
}
type inputNodeFactory struct{}
func (f inputNodeFactory) Name() string { return "InputNode" }
func (f inputNodeFactory) Category() string { return NODE_CATEGORY_OTHERS }
func (f inputNodeFactory) Labels() []string { return []string{} }
func (f inputNodeFactory) Create(id string, meta Metadata) (Node, error) {
node := &inputNode{
bareNode: newBareNode(InputNodeName, id, meta, f.Labels()),
}
return node, nil
}
func (n *inputNode) Handle(msg message.Message) error {
logrus.Infof("%s handle message '%s'", n.Name(), msg.GetType())
nodes := n.GetLinkedNodes()
for _, node := range nodes {
return node.Handle(msg)
}
return nil
}